github.com/cilium/cilium@v1.16.2/api/v1/models/endpoint_change_request.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 14 "github.com/go-openapi/errors" 15 "github.com/go-openapi/strfmt" 16 "github.com/go-openapi/swag" 17 "github.com/go-openapi/validate" 18 ) 19 20 // EndpointChangeRequest Structure which contains the mutable elements of an Endpoint. 21 // 22 // swagger:model EndpointChangeRequest 23 type EndpointChangeRequest struct { 24 25 // addressing 26 Addressing *AddressPair `json:"addressing,omitempty"` 27 28 // ID assigned by container runtime 29 ContainerID string `json:"container-id,omitempty"` 30 31 // Name of network device in container netns 32 ContainerInterfaceName string `json:"container-interface-name,omitempty"` 33 34 // Name assigned to container 35 ContainerName string `json:"container-name,omitempty"` 36 37 // datapath configuration 38 DatapathConfiguration *EndpointDatapathConfiguration `json:"datapath-configuration,omitempty"` 39 40 // ID of datapath tail call map 41 DatapathMapID int64 `json:"datapath-map-id,omitempty"` 42 43 // Disables lookup using legacy endpoint identifiers (container name, container id, pod name) for this endpoint 44 DisableLegacyIdentifiers bool `json:"disable-legacy-identifiers,omitempty"` 45 46 // Docker endpoint ID 47 DockerEndpointID string `json:"docker-endpoint-id,omitempty"` 48 49 // Docker network ID 50 DockerNetworkID string `json:"docker-network-id,omitempty"` 51 52 // MAC address 53 HostMac string `json:"host-mac,omitempty"` 54 55 // Local endpoint ID 56 ID int64 `json:"id,omitempty"` 57 58 // Index of network device in host netns 59 InterfaceIndex int64 `json:"interface-index,omitempty"` 60 61 // Name of network device in host netns 62 InterfaceName string `json:"interface-name,omitempty"` 63 64 // Kubernetes namespace name 65 K8sNamespace string `json:"k8s-namespace,omitempty"` 66 67 // Kubernetes pod name 68 K8sPodName string `json:"k8s-pod-name,omitempty"` 69 70 // Kubernetes pod UID 71 K8sUID string `json:"k8s-uid,omitempty"` 72 73 // Labels describing the identity 74 Labels Labels `json:"labels,omitempty"` 75 76 // MAC address 77 Mac string `json:"mac,omitempty"` 78 79 // Network namespace cookie 80 NetnsCookie string `json:"netns-cookie,omitempty"` 81 82 // Process ID of the workload belonging to this endpoint 83 Pid int64 `json:"pid,omitempty"` 84 85 // Whether policy enforcement is enabled or not 86 PolicyEnabled bool `json:"policy-enabled,omitempty"` 87 88 // Properties is used to store information about the endpoint at creation. Useful for tests. 89 Properties map[string]interface{} `json:"properties,omitempty"` 90 91 // Current state of endpoint 92 // Required: true 93 State *EndpointState `json:"state"` 94 95 // Whether to build an endpoint synchronously 96 // 97 SyncBuildEndpoint bool `json:"sync-build-endpoint,omitempty"` 98 } 99 100 // Validate validates this endpoint change request 101 func (m *EndpointChangeRequest) Validate(formats strfmt.Registry) error { 102 var res []error 103 104 if err := m.validateAddressing(formats); err != nil { 105 res = append(res, err) 106 } 107 108 if err := m.validateDatapathConfiguration(formats); err != nil { 109 res = append(res, err) 110 } 111 112 if err := m.validateLabels(formats); err != nil { 113 res = append(res, err) 114 } 115 116 if err := m.validateState(formats); err != nil { 117 res = append(res, err) 118 } 119 120 if len(res) > 0 { 121 return errors.CompositeValidationError(res...) 122 } 123 return nil 124 } 125 126 func (m *EndpointChangeRequest) validateAddressing(formats strfmt.Registry) error { 127 if swag.IsZero(m.Addressing) { // not required 128 return nil 129 } 130 131 if m.Addressing != nil { 132 if err := m.Addressing.Validate(formats); err != nil { 133 if ve, ok := err.(*errors.Validation); ok { 134 return ve.ValidateName("addressing") 135 } else if ce, ok := err.(*errors.CompositeError); ok { 136 return ce.ValidateName("addressing") 137 } 138 return err 139 } 140 } 141 142 return nil 143 } 144 145 func (m *EndpointChangeRequest) validateDatapathConfiguration(formats strfmt.Registry) error { 146 if swag.IsZero(m.DatapathConfiguration) { // not required 147 return nil 148 } 149 150 if m.DatapathConfiguration != nil { 151 if err := m.DatapathConfiguration.Validate(formats); err != nil { 152 if ve, ok := err.(*errors.Validation); ok { 153 return ve.ValidateName("datapath-configuration") 154 } else if ce, ok := err.(*errors.CompositeError); ok { 155 return ce.ValidateName("datapath-configuration") 156 } 157 return err 158 } 159 } 160 161 return nil 162 } 163 164 func (m *EndpointChangeRequest) validateLabels(formats strfmt.Registry) error { 165 if swag.IsZero(m.Labels) { // not required 166 return nil 167 } 168 169 if err := m.Labels.Validate(formats); err != nil { 170 if ve, ok := err.(*errors.Validation); ok { 171 return ve.ValidateName("labels") 172 } else if ce, ok := err.(*errors.CompositeError); ok { 173 return ce.ValidateName("labels") 174 } 175 return err 176 } 177 178 return nil 179 } 180 181 func (m *EndpointChangeRequest) validateState(formats strfmt.Registry) error { 182 183 if err := validate.Required("state", "body", m.State); err != nil { 184 return err 185 } 186 187 if err := validate.Required("state", "body", m.State); err != nil { 188 return err 189 } 190 191 if m.State != nil { 192 if err := m.State.Validate(formats); err != nil { 193 if ve, ok := err.(*errors.Validation); ok { 194 return ve.ValidateName("state") 195 } else if ce, ok := err.(*errors.CompositeError); ok { 196 return ce.ValidateName("state") 197 } 198 return err 199 } 200 } 201 202 return nil 203 } 204 205 // ContextValidate validate this endpoint change request based on the context it is used 206 func (m *EndpointChangeRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 207 var res []error 208 209 if err := m.contextValidateAddressing(ctx, formats); err != nil { 210 res = append(res, err) 211 } 212 213 if err := m.contextValidateDatapathConfiguration(ctx, formats); err != nil { 214 res = append(res, err) 215 } 216 217 if err := m.contextValidateLabels(ctx, formats); err != nil { 218 res = append(res, err) 219 } 220 221 if err := m.contextValidateState(ctx, formats); err != nil { 222 res = append(res, err) 223 } 224 225 if len(res) > 0 { 226 return errors.CompositeValidationError(res...) 227 } 228 return nil 229 } 230 231 func (m *EndpointChangeRequest) contextValidateAddressing(ctx context.Context, formats strfmt.Registry) error { 232 233 if m.Addressing != nil { 234 235 if swag.IsZero(m.Addressing) { // not required 236 return nil 237 } 238 239 if err := m.Addressing.ContextValidate(ctx, formats); err != nil { 240 if ve, ok := err.(*errors.Validation); ok { 241 return ve.ValidateName("addressing") 242 } else if ce, ok := err.(*errors.CompositeError); ok { 243 return ce.ValidateName("addressing") 244 } 245 return err 246 } 247 } 248 249 return nil 250 } 251 252 func (m *EndpointChangeRequest) contextValidateDatapathConfiguration(ctx context.Context, formats strfmt.Registry) error { 253 254 if m.DatapathConfiguration != nil { 255 256 if swag.IsZero(m.DatapathConfiguration) { // not required 257 return nil 258 } 259 260 if err := m.DatapathConfiguration.ContextValidate(ctx, formats); err != nil { 261 if ve, ok := err.(*errors.Validation); ok { 262 return ve.ValidateName("datapath-configuration") 263 } else if ce, ok := err.(*errors.CompositeError); ok { 264 return ce.ValidateName("datapath-configuration") 265 } 266 return err 267 } 268 } 269 270 return nil 271 } 272 273 func (m *EndpointChangeRequest) contextValidateLabels(ctx context.Context, formats strfmt.Registry) error { 274 275 if err := m.Labels.ContextValidate(ctx, formats); err != nil { 276 if ve, ok := err.(*errors.Validation); ok { 277 return ve.ValidateName("labels") 278 } else if ce, ok := err.(*errors.CompositeError); ok { 279 return ce.ValidateName("labels") 280 } 281 return err 282 } 283 284 return nil 285 } 286 287 func (m *EndpointChangeRequest) contextValidateState(ctx context.Context, formats strfmt.Registry) error { 288 289 if m.State != nil { 290 291 if err := m.State.ContextValidate(ctx, formats); err != nil { 292 if ve, ok := err.(*errors.Validation); ok { 293 return ve.ValidateName("state") 294 } else if ce, ok := err.(*errors.CompositeError); ok { 295 return ce.ValidateName("state") 296 } 297 return err 298 } 299 } 300 301 return nil 302 } 303 304 // MarshalBinary interface implementation 305 func (m *EndpointChangeRequest) MarshalBinary() ([]byte, error) { 306 if m == nil { 307 return nil, nil 308 } 309 return swag.WriteJSON(m) 310 } 311 312 // UnmarshalBinary interface implementation 313 func (m *EndpointChangeRequest) UnmarshalBinary(b []byte) error { 314 var res EndpointChangeRequest 315 if err := swag.ReadJSON(b, &res); err != nil { 316 return err 317 } 318 *m = res 319 return nil 320 }