github.com/cilium/cilium@v1.16.2/api/v1/models/c_n_i_chaining_status.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 // Copyright Authors of Cilium 4 // SPDX-License-Identifier: Apache-2.0 5 6 package models 7 8 // This file was generated by the swagger tool. 9 // Editing this file might prove futile when you re-run the swagger generate command 10 11 import ( 12 "context" 13 "encoding/json" 14 15 "github.com/go-openapi/errors" 16 "github.com/go-openapi/strfmt" 17 "github.com/go-openapi/swag" 18 "github.com/go-openapi/validate" 19 ) 20 21 // CNIChainingStatus Status of CNI chaining 22 // 23 // +k8s:deepcopy-gen=true 24 // 25 // swagger:model CNIChainingStatus 26 type CNIChainingStatus struct { 27 28 // mode 29 // Enum: [none aws-cni flannel generic-veth portmap] 30 Mode string `json:"mode,omitempty"` 31 } 32 33 // Validate validates this c n i chaining status 34 func (m *CNIChainingStatus) Validate(formats strfmt.Registry) error { 35 var res []error 36 37 if err := m.validateMode(formats); err != nil { 38 res = append(res, err) 39 } 40 41 if len(res) > 0 { 42 return errors.CompositeValidationError(res...) 43 } 44 return nil 45 } 46 47 var cNIChainingStatusTypeModePropEnum []interface{} 48 49 func init() { 50 var res []string 51 if err := json.Unmarshal([]byte(`["none","aws-cni","flannel","generic-veth","portmap"]`), &res); err != nil { 52 panic(err) 53 } 54 for _, v := range res { 55 cNIChainingStatusTypeModePropEnum = append(cNIChainingStatusTypeModePropEnum, v) 56 } 57 } 58 59 const ( 60 61 // CNIChainingStatusModeNone captures enum value "none" 62 CNIChainingStatusModeNone string = "none" 63 64 // CNIChainingStatusModeAwsDashCni captures enum value "aws-cni" 65 CNIChainingStatusModeAwsDashCni string = "aws-cni" 66 67 // CNIChainingStatusModeFlannel captures enum value "flannel" 68 CNIChainingStatusModeFlannel string = "flannel" 69 70 // CNIChainingStatusModeGenericDashVeth captures enum value "generic-veth" 71 CNIChainingStatusModeGenericDashVeth string = "generic-veth" 72 73 // CNIChainingStatusModePortmap captures enum value "portmap" 74 CNIChainingStatusModePortmap string = "portmap" 75 ) 76 77 // prop value enum 78 func (m *CNIChainingStatus) validateModeEnum(path, location string, value string) error { 79 if err := validate.EnumCase(path, location, value, cNIChainingStatusTypeModePropEnum, true); err != nil { 80 return err 81 } 82 return nil 83 } 84 85 func (m *CNIChainingStatus) validateMode(formats strfmt.Registry) error { 86 if swag.IsZero(m.Mode) { // not required 87 return nil 88 } 89 90 // value enum 91 if err := m.validateModeEnum("mode", "body", m.Mode); err != nil { 92 return err 93 } 94 95 return nil 96 } 97 98 // ContextValidate validates this c n i chaining status based on context it is used 99 func (m *CNIChainingStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 100 return nil 101 } 102 103 // MarshalBinary interface implementation 104 func (m *CNIChainingStatus) MarshalBinary() ([]byte, error) { 105 if m == nil { 106 return nil, nil 107 } 108 return swag.WriteJSON(m) 109 } 110 111 // UnmarshalBinary interface implementation 112 func (m *CNIChainingStatus) UnmarshalBinary(b []byte) error { 113 var res CNIChainingStatus 114 if err := swag.ReadJSON(b, &res); err != nil { 115 return err 116 } 117 *m = res 118 return nil 119 }