2021-11-16 18:15:56 +00:00
|
|
|
package apistatus
|
|
|
|
|
|
|
|
import (
|
2022-12-13 14:36:35 +00:00
|
|
|
"github.com/TrueCloudLab/frostfs-api-go/v2/status"
|
2021-11-16 18:15:56 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// SuccessDefaultV2 represents Status instance of default success. Implements StatusV2.
|
|
|
|
type SuccessDefaultV2 struct {
|
|
|
|
isNil bool
|
|
|
|
|
|
|
|
v2 *status.Status
|
|
|
|
}
|
|
|
|
|
2022-02-01 11:55:21 +00:00
|
|
|
// implements local interface defined in FromStatusV2 func.
|
2021-11-16 18:15:56 +00:00
|
|
|
func (x *SuccessDefaultV2) fromStatusV2(st *status.Status) {
|
|
|
|
x.isNil = st == nil
|
|
|
|
x.v2 = st
|
|
|
|
}
|
|
|
|
|
|
|
|
// ToStatusV2 implements StatusV2 interface method.
|
|
|
|
// If the value was returned by FromStatusV2, returns the source message.
|
|
|
|
// Otherwise, returns message with
|
2022-08-24 14:17:40 +00:00
|
|
|
// - code: OK;
|
|
|
|
// - string message: empty;
|
|
|
|
// - details: empty.
|
2021-11-16 18:15:56 +00:00
|
|
|
func (x SuccessDefaultV2) ToStatusV2() *status.Status {
|
|
|
|
if x.isNil || x.v2 != nil {
|
|
|
|
return x.v2
|
|
|
|
}
|
|
|
|
|
|
|
|
return newStatusV2WithLocalCode(status.OK, status.GlobalizeSuccess)
|
|
|
|
}
|