predictor/pkg/rest/oas_schemas_gen.go
2025-06-25 23:23:16 +03:00

908 lines
24 KiB
Go

// Code generated by ogen, DO NOT EDIT.
package gsn
import (
"fmt"
"time"
"github.com/go-faster/errors"
)
func (s *ErrorStatusCode) Error() string {
return fmt.Sprintf("code %d: %+v", s.StatusCode, s.Response)
}
// Ref: #/components/schemas/Error
type Error struct {
Message string `json:"message"`
Details OptString `json:"details"`
}
// GetMessage returns the value of Message.
func (s *Error) GetMessage() string {
return s.Message
}
// GetDetails returns the value of Details.
func (s *Error) GetDetails() OptString {
return s.Details
}
// SetMessage sets the value of Message.
func (s *Error) SetMessage(val string) {
s.Message = val
}
// SetDetails sets the value of Details.
func (s *Error) SetDetails(val OptString) {
s.Details = val
}
// ErrorStatusCode wraps Error with StatusCode.
type ErrorStatusCode struct {
StatusCode int
Response Error
}
// GetStatusCode returns the value of StatusCode.
func (s *ErrorStatusCode) GetStatusCode() int {
return s.StatusCode
}
// GetResponse returns the value of Response.
func (s *ErrorStatusCode) GetResponse() Error {
return s.Response
}
// SetStatusCode sets the value of StatusCode.
func (s *ErrorStatusCode) SetStatusCode(val int) {
s.StatusCode = val
}
// SetResponse sets the value of Response.
func (s *ErrorStatusCode) SetResponse(val Error) {
s.Response = val
}
// NewOptBool returns new OptBool with value set to v.
func NewOptBool(v bool) OptBool {
return OptBool{
Value: v,
Set: true,
}
}
// OptBool is optional bool.
type OptBool struct {
Value bool
Set bool
}
// IsSet returns true if OptBool was set.
func (o OptBool) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptBool) Reset() {
var v bool
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptBool) SetTo(v bool) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptBool) Get() (v bool, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptBool) Or(d bool) bool {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptDateTime returns new OptDateTime with value set to v.
func NewOptDateTime(v time.Time) OptDateTime {
return OptDateTime{
Value: v,
Set: true,
}
}
// OptDateTime is optional time.Time.
type OptDateTime struct {
Value time.Time
Set bool
}
// IsSet returns true if OptDateTime was set.
func (o OptDateTime) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptDateTime) Reset() {
var v time.Time
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptDateTime) SetTo(v time.Time) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptDateTime) Get() (v time.Time, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptDateTime) Or(d time.Time) time.Time {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptFloat64 returns new OptFloat64 with value set to v.
func NewOptFloat64(v float64) OptFloat64 {
return OptFloat64{
Value: v,
Set: true,
}
}
// OptFloat64 is optional float64.
type OptFloat64 struct {
Value float64
Set bool
}
// IsSet returns true if OptFloat64 was set.
func (o OptFloat64) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptFloat64) Reset() {
var v float64
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptFloat64) SetTo(v float64) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptFloat64) Get() (v float64, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptFloat64) Or(d float64) float64 {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptPredictionParameters returns new OptPredictionParameters with value set to v.
func NewOptPredictionParameters(v PredictionParameters) OptPredictionParameters {
return OptPredictionParameters{
Value: v,
Set: true,
}
}
// OptPredictionParameters is optional PredictionParameters.
type OptPredictionParameters struct {
Value PredictionParameters
Set bool
}
// IsSet returns true if OptPredictionParameters was set.
func (o OptPredictionParameters) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptPredictionParameters) Reset() {
var v PredictionParameters
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptPredictionParameters) SetTo(v PredictionParameters) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptPredictionParameters) Get() (v PredictionParameters, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptPredictionParameters) Or(d PredictionParameters) PredictionParameters {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptPredictionParametersFormat returns new OptPredictionParametersFormat with value set to v.
func NewOptPredictionParametersFormat(v PredictionParametersFormat) OptPredictionParametersFormat {
return OptPredictionParametersFormat{
Value: v,
Set: true,
}
}
// OptPredictionParametersFormat is optional PredictionParametersFormat.
type OptPredictionParametersFormat struct {
Value PredictionParametersFormat
Set bool
}
// IsSet returns true if OptPredictionParametersFormat was set.
func (o OptPredictionParametersFormat) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptPredictionParametersFormat) Reset() {
var v PredictionParametersFormat
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptPredictionParametersFormat) SetTo(v PredictionParametersFormat) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptPredictionParametersFormat) Get() (v PredictionParametersFormat, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptPredictionParametersFormat) Or(d PredictionParametersFormat) PredictionParametersFormat {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptPredictionParametersProfile returns new OptPredictionParametersProfile with value set to v.
func NewOptPredictionParametersProfile(v PredictionParametersProfile) OptPredictionParametersProfile {
return OptPredictionParametersProfile{
Value: v,
Set: true,
}
}
// OptPredictionParametersProfile is optional PredictionParametersProfile.
type OptPredictionParametersProfile struct {
Value PredictionParametersProfile
Set bool
}
// IsSet returns true if OptPredictionParametersProfile was set.
func (o OptPredictionParametersProfile) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptPredictionParametersProfile) Reset() {
var v PredictionParametersProfile
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptPredictionParametersProfile) SetTo(v PredictionParametersProfile) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptPredictionParametersProfile) Get() (v PredictionParametersProfile, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptPredictionParametersProfile) Or(d PredictionParametersProfile) PredictionParametersProfile {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptString returns new OptString with value set to v.
func NewOptString(v string) OptString {
return OptString{
Value: v,
Set: true,
}
}
// OptString is optional string.
type OptString struct {
Value string
Set bool
}
// IsSet returns true if OptString was set.
func (o OptString) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptString) Reset() {
var v string
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptString) SetTo(v string) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptString) Get() (v string, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptString) Or(d string) string {
if v, ok := o.Get(); ok {
return v
}
return d
}
// Ref: #/components/schemas/PredictionParameters
type PredictionParameters struct {
LaunchLatitude OptFloat64 `json:"launch_latitude"`
LaunchLongitude OptFloat64 `json:"launch_longitude"`
LaunchDatetime OptDateTime `json:"launch_datetime"`
LaunchAltitude OptFloat64 `json:"launch_altitude"`
Profile OptPredictionParametersProfile `json:"profile"`
AscentRate OptFloat64 `json:"ascent_rate"`
BurstAltitude OptFloat64 `json:"burst_altitude"`
DescentRate OptFloat64 `json:"descent_rate"`
FloatAltitude OptFloat64 `json:"float_altitude"`
StopDatetime OptDateTime `json:"stop_datetime"`
// Base64 encoded ascent curve.
AscentCurve OptString `json:"ascent_curve"`
// Base64 encoded descent curve.
DescentCurve OptString `json:"descent_curve"`
Interpolate OptBool `json:"interpolate"`
Format OptPredictionParametersFormat `json:"format"`
Dataset OptDateTime `json:"dataset"`
}
// GetLaunchLatitude returns the value of LaunchLatitude.
func (s *PredictionParameters) GetLaunchLatitude() OptFloat64 {
return s.LaunchLatitude
}
// GetLaunchLongitude returns the value of LaunchLongitude.
func (s *PredictionParameters) GetLaunchLongitude() OptFloat64 {
return s.LaunchLongitude
}
// GetLaunchDatetime returns the value of LaunchDatetime.
func (s *PredictionParameters) GetLaunchDatetime() OptDateTime {
return s.LaunchDatetime
}
// GetLaunchAltitude returns the value of LaunchAltitude.
func (s *PredictionParameters) GetLaunchAltitude() OptFloat64 {
return s.LaunchAltitude
}
// GetProfile returns the value of Profile.
func (s *PredictionParameters) GetProfile() OptPredictionParametersProfile {
return s.Profile
}
// GetAscentRate returns the value of AscentRate.
func (s *PredictionParameters) GetAscentRate() OptFloat64 {
return s.AscentRate
}
// GetBurstAltitude returns the value of BurstAltitude.
func (s *PredictionParameters) GetBurstAltitude() OptFloat64 {
return s.BurstAltitude
}
// GetDescentRate returns the value of DescentRate.
func (s *PredictionParameters) GetDescentRate() OptFloat64 {
return s.DescentRate
}
// GetFloatAltitude returns the value of FloatAltitude.
func (s *PredictionParameters) GetFloatAltitude() OptFloat64 {
return s.FloatAltitude
}
// GetStopDatetime returns the value of StopDatetime.
func (s *PredictionParameters) GetStopDatetime() OptDateTime {
return s.StopDatetime
}
// GetAscentCurve returns the value of AscentCurve.
func (s *PredictionParameters) GetAscentCurve() OptString {
return s.AscentCurve
}
// GetDescentCurve returns the value of DescentCurve.
func (s *PredictionParameters) GetDescentCurve() OptString {
return s.DescentCurve
}
// GetInterpolate returns the value of Interpolate.
func (s *PredictionParameters) GetInterpolate() OptBool {
return s.Interpolate
}
// GetFormat returns the value of Format.
func (s *PredictionParameters) GetFormat() OptPredictionParametersFormat {
return s.Format
}
// GetDataset returns the value of Dataset.
func (s *PredictionParameters) GetDataset() OptDateTime {
return s.Dataset
}
// SetLaunchLatitude sets the value of LaunchLatitude.
func (s *PredictionParameters) SetLaunchLatitude(val OptFloat64) {
s.LaunchLatitude = val
}
// SetLaunchLongitude sets the value of LaunchLongitude.
func (s *PredictionParameters) SetLaunchLongitude(val OptFloat64) {
s.LaunchLongitude = val
}
// SetLaunchDatetime sets the value of LaunchDatetime.
func (s *PredictionParameters) SetLaunchDatetime(val OptDateTime) {
s.LaunchDatetime = val
}
// SetLaunchAltitude sets the value of LaunchAltitude.
func (s *PredictionParameters) SetLaunchAltitude(val OptFloat64) {
s.LaunchAltitude = val
}
// SetProfile sets the value of Profile.
func (s *PredictionParameters) SetProfile(val OptPredictionParametersProfile) {
s.Profile = val
}
// SetAscentRate sets the value of AscentRate.
func (s *PredictionParameters) SetAscentRate(val OptFloat64) {
s.AscentRate = val
}
// SetBurstAltitude sets the value of BurstAltitude.
func (s *PredictionParameters) SetBurstAltitude(val OptFloat64) {
s.BurstAltitude = val
}
// SetDescentRate sets the value of DescentRate.
func (s *PredictionParameters) SetDescentRate(val OptFloat64) {
s.DescentRate = val
}
// SetFloatAltitude sets the value of FloatAltitude.
func (s *PredictionParameters) SetFloatAltitude(val OptFloat64) {
s.FloatAltitude = val
}
// SetStopDatetime sets the value of StopDatetime.
func (s *PredictionParameters) SetStopDatetime(val OptDateTime) {
s.StopDatetime = val
}
// SetAscentCurve sets the value of AscentCurve.
func (s *PredictionParameters) SetAscentCurve(val OptString) {
s.AscentCurve = val
}
// SetDescentCurve sets the value of DescentCurve.
func (s *PredictionParameters) SetDescentCurve(val OptString) {
s.DescentCurve = val
}
// SetInterpolate sets the value of Interpolate.
func (s *PredictionParameters) SetInterpolate(val OptBool) {
s.Interpolate = val
}
// SetFormat sets the value of Format.
func (s *PredictionParameters) SetFormat(val OptPredictionParametersFormat) {
s.Format = val
}
// SetDataset sets the value of Dataset.
func (s *PredictionParameters) SetDataset(val OptDateTime) {
s.Dataset = val
}
type PredictionParametersFormat string
const (
PredictionParametersFormatJSON PredictionParametersFormat = "json"
)
// AllValues returns all PredictionParametersFormat values.
func (PredictionParametersFormat) AllValues() []PredictionParametersFormat {
return []PredictionParametersFormat{
PredictionParametersFormatJSON,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s PredictionParametersFormat) MarshalText() ([]byte, error) {
switch s {
case PredictionParametersFormatJSON:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *PredictionParametersFormat) UnmarshalText(data []byte) error {
switch PredictionParametersFormat(data) {
case PredictionParametersFormatJSON:
*s = PredictionParametersFormatJSON
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
type PredictionParametersProfile string
const (
PredictionParametersProfileStandardProfile PredictionParametersProfile = "standard_profile"
PredictionParametersProfileFloatProfile PredictionParametersProfile = "float_profile"
PredictionParametersProfileReverseProfile PredictionParametersProfile = "reverse_profile"
PredictionParametersProfileCustomProfile PredictionParametersProfile = "custom_profile"
)
// AllValues returns all PredictionParametersProfile values.
func (PredictionParametersProfile) AllValues() []PredictionParametersProfile {
return []PredictionParametersProfile{
PredictionParametersProfileStandardProfile,
PredictionParametersProfileFloatProfile,
PredictionParametersProfileReverseProfile,
PredictionParametersProfileCustomProfile,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s PredictionParametersProfile) MarshalText() ([]byte, error) {
switch s {
case PredictionParametersProfileStandardProfile:
return []byte(s), nil
case PredictionParametersProfileFloatProfile:
return []byte(s), nil
case PredictionParametersProfileReverseProfile:
return []byte(s), nil
case PredictionParametersProfileCustomProfile:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *PredictionParametersProfile) UnmarshalText(data []byte) error {
switch PredictionParametersProfile(data) {
case PredictionParametersProfileStandardProfile:
*s = PredictionParametersProfileStandardProfile
return nil
case PredictionParametersProfileFloatProfile:
*s = PredictionParametersProfileFloatProfile
return nil
case PredictionParametersProfileReverseProfile:
*s = PredictionParametersProfileReverseProfile
return nil
case PredictionParametersProfileCustomProfile:
*s = PredictionParametersProfileCustomProfile
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// Ref: #/components/schemas/PredictionResult
type PredictionResult struct {
Metadata PredictionResultMetadata `json:"metadata"`
Prediction []PredictionResultPredictionItem `json:"prediction"`
}
// GetMetadata returns the value of Metadata.
func (s *PredictionResult) GetMetadata() PredictionResultMetadata {
return s.Metadata
}
// GetPrediction returns the value of Prediction.
func (s *PredictionResult) GetPrediction() []PredictionResultPredictionItem {
return s.Prediction
}
// SetMetadata sets the value of Metadata.
func (s *PredictionResult) SetMetadata(val PredictionResultMetadata) {
s.Metadata = val
}
// SetPrediction sets the value of Prediction.
func (s *PredictionResult) SetPrediction(val []PredictionResultPredictionItem) {
s.Prediction = val
}
type PredictionResultMetadata struct {
CompleteDatetime time.Time `json:"complete_datetime"`
StartDatetime time.Time `json:"start_datetime"`
}
// GetCompleteDatetime returns the value of CompleteDatetime.
func (s *PredictionResultMetadata) GetCompleteDatetime() time.Time {
return s.CompleteDatetime
}
// GetStartDatetime returns the value of StartDatetime.
func (s *PredictionResultMetadata) GetStartDatetime() time.Time {
return s.StartDatetime
}
// SetCompleteDatetime sets the value of CompleteDatetime.
func (s *PredictionResultMetadata) SetCompleteDatetime(val time.Time) {
s.CompleteDatetime = val
}
// SetStartDatetime sets the value of StartDatetime.
func (s *PredictionResultMetadata) SetStartDatetime(val time.Time) {
s.StartDatetime = val
}
type PredictionResultPredictionItem struct {
Stage PredictionResultPredictionItemStage `json:"stage"`
Trajectory []PredictionResultPredictionItemTrajectoryItem `json:"trajectory"`
}
// GetStage returns the value of Stage.
func (s *PredictionResultPredictionItem) GetStage() PredictionResultPredictionItemStage {
return s.Stage
}
// GetTrajectory returns the value of Trajectory.
func (s *PredictionResultPredictionItem) GetTrajectory() []PredictionResultPredictionItemTrajectoryItem {
return s.Trajectory
}
// SetStage sets the value of Stage.
func (s *PredictionResultPredictionItem) SetStage(val PredictionResultPredictionItemStage) {
s.Stage = val
}
// SetTrajectory sets the value of Trajectory.
func (s *PredictionResultPredictionItem) SetTrajectory(val []PredictionResultPredictionItemTrajectoryItem) {
s.Trajectory = val
}
type PredictionResultPredictionItemStage string
const (
PredictionResultPredictionItemStageAscent PredictionResultPredictionItemStage = "ascent"
PredictionResultPredictionItemStageDescent PredictionResultPredictionItemStage = "descent"
)
// AllValues returns all PredictionResultPredictionItemStage values.
func (PredictionResultPredictionItemStage) AllValues() []PredictionResultPredictionItemStage {
return []PredictionResultPredictionItemStage{
PredictionResultPredictionItemStageAscent,
PredictionResultPredictionItemStageDescent,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s PredictionResultPredictionItemStage) MarshalText() ([]byte, error) {
switch s {
case PredictionResultPredictionItemStageAscent:
return []byte(s), nil
case PredictionResultPredictionItemStageDescent:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *PredictionResultPredictionItemStage) UnmarshalText(data []byte) error {
switch PredictionResultPredictionItemStage(data) {
case PredictionResultPredictionItemStageAscent:
*s = PredictionResultPredictionItemStageAscent
return nil
case PredictionResultPredictionItemStageDescent:
*s = PredictionResultPredictionItemStageDescent
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
type PredictionResultPredictionItemTrajectoryItem struct {
Datetime time.Time `json:"datetime"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Altitude float64 `json:"altitude"`
}
// GetDatetime returns the value of Datetime.
func (s *PredictionResultPredictionItemTrajectoryItem) GetDatetime() time.Time {
return s.Datetime
}
// GetLatitude returns the value of Latitude.
func (s *PredictionResultPredictionItemTrajectoryItem) GetLatitude() float64 {
return s.Latitude
}
// GetLongitude returns the value of Longitude.
func (s *PredictionResultPredictionItemTrajectoryItem) GetLongitude() float64 {
return s.Longitude
}
// GetAltitude returns the value of Altitude.
func (s *PredictionResultPredictionItemTrajectoryItem) GetAltitude() float64 {
return s.Altitude
}
// SetDatetime sets the value of Datetime.
func (s *PredictionResultPredictionItemTrajectoryItem) SetDatetime(val time.Time) {
s.Datetime = val
}
// SetLatitude sets the value of Latitude.
func (s *PredictionResultPredictionItemTrajectoryItem) SetLatitude(val float64) {
s.Latitude = val
}
// SetLongitude sets the value of Longitude.
func (s *PredictionResultPredictionItemTrajectoryItem) SetLongitude(val float64) {
s.Longitude = val
}
// SetAltitude sets the value of Altitude.
func (s *PredictionResultPredictionItemTrajectoryItem) SetAltitude(val float64) {
s.Altitude = val
}
// Ref: #/components/schemas/ReadinessResponse
type ReadinessResponse struct {
Status ReadinessResponseStatus `json:"status"`
LastUpdate OptDateTime `json:"last_update"`
IsFresh OptBool `json:"is_fresh"`
ErrorMessage OptString `json:"error_message"`
}
// GetStatus returns the value of Status.
func (s *ReadinessResponse) GetStatus() ReadinessResponseStatus {
return s.Status
}
// GetLastUpdate returns the value of LastUpdate.
func (s *ReadinessResponse) GetLastUpdate() OptDateTime {
return s.LastUpdate
}
// GetIsFresh returns the value of IsFresh.
func (s *ReadinessResponse) GetIsFresh() OptBool {
return s.IsFresh
}
// GetErrorMessage returns the value of ErrorMessage.
func (s *ReadinessResponse) GetErrorMessage() OptString {
return s.ErrorMessage
}
// SetStatus sets the value of Status.
func (s *ReadinessResponse) SetStatus(val ReadinessResponseStatus) {
s.Status = val
}
// SetLastUpdate sets the value of LastUpdate.
func (s *ReadinessResponse) SetLastUpdate(val OptDateTime) {
s.LastUpdate = val
}
// SetIsFresh sets the value of IsFresh.
func (s *ReadinessResponse) SetIsFresh(val OptBool) {
s.IsFresh = val
}
// SetErrorMessage sets the value of ErrorMessage.
func (s *ReadinessResponse) SetErrorMessage(val OptString) {
s.ErrorMessage = val
}
type ReadinessResponseStatus string
const (
ReadinessResponseStatusOk ReadinessResponseStatus = "ok"
ReadinessResponseStatusNotReady ReadinessResponseStatus = "not_ready"
ReadinessResponseStatusError ReadinessResponseStatus = "error"
)
// AllValues returns all ReadinessResponseStatus values.
func (ReadinessResponseStatus) AllValues() []ReadinessResponseStatus {
return []ReadinessResponseStatus{
ReadinessResponseStatusOk,
ReadinessResponseStatusNotReady,
ReadinessResponseStatusError,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s ReadinessResponseStatus) MarshalText() ([]byte, error) {
switch s {
case ReadinessResponseStatusOk:
return []byte(s), nil
case ReadinessResponseStatusNotReady:
return []byte(s), nil
case ReadinessResponseStatusError:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *ReadinessResponseStatus) UnmarshalText(data []byte) error {
switch ReadinessResponseStatus(data) {
case ReadinessResponseStatusOk:
*s = ReadinessResponseStatusOk
return nil
case ReadinessResponseStatusNotReady:
*s = ReadinessResponseStatusNotReady
return nil
case ReadinessResponseStatusError:
*s = ReadinessResponseStatusError
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}