github.com/cilium/cilium@v1.16.2/api/v1/models/endpoint_state.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/validate"
    18  )
    19  
    20  // EndpointState State of endpoint
    21  //
    22  // swagger:model EndpointState
    23  type EndpointState string
    24  
    25  func NewEndpointState(value EndpointState) *EndpointState {
    26  	return &value
    27  }
    28  
    29  // Pointer returns a pointer to a freshly-allocated EndpointState.
    30  func (m EndpointState) Pointer() *EndpointState {
    31  	return &m
    32  }
    33  
    34  const (
    35  
    36  	// EndpointStateWaitingDashForDashIdentity captures enum value "waiting-for-identity"
    37  	EndpointStateWaitingDashForDashIdentity EndpointState = "waiting-for-identity"
    38  
    39  	// EndpointStateNotDashReady captures enum value "not-ready"
    40  	EndpointStateNotDashReady EndpointState = "not-ready"
    41  
    42  	// EndpointStateWaitingDashToDashRegenerate captures enum value "waiting-to-regenerate"
    43  	EndpointStateWaitingDashToDashRegenerate EndpointState = "waiting-to-regenerate"
    44  
    45  	// EndpointStateRegenerating captures enum value "regenerating"
    46  	EndpointStateRegenerating EndpointState = "regenerating"
    47  
    48  	// EndpointStateRestoring captures enum value "restoring"
    49  	EndpointStateRestoring EndpointState = "restoring"
    50  
    51  	// EndpointStateReady captures enum value "ready"
    52  	EndpointStateReady EndpointState = "ready"
    53  
    54  	// EndpointStateDisconnecting captures enum value "disconnecting"
    55  	EndpointStateDisconnecting EndpointState = "disconnecting"
    56  
    57  	// EndpointStateDisconnected captures enum value "disconnected"
    58  	EndpointStateDisconnected EndpointState = "disconnected"
    59  
    60  	// EndpointStateInvalid captures enum value "invalid"
    61  	EndpointStateInvalid EndpointState = "invalid"
    62  )
    63  
    64  // for schema
    65  var endpointStateEnum []interface{}
    66  
    67  func init() {
    68  	var res []EndpointState
    69  	if err := json.Unmarshal([]byte(`["waiting-for-identity","not-ready","waiting-to-regenerate","regenerating","restoring","ready","disconnecting","disconnected","invalid"]`), &res); err != nil {
    70  		panic(err)
    71  	}
    72  	for _, v := range res {
    73  		endpointStateEnum = append(endpointStateEnum, v)
    74  	}
    75  }
    76  
    77  func (m EndpointState) validateEndpointStateEnum(path, location string, value EndpointState) error {
    78  	if err := validate.EnumCase(path, location, value, endpointStateEnum, true); err != nil {
    79  		return err
    80  	}
    81  	return nil
    82  }
    83  
    84  // Validate validates this endpoint state
    85  func (m EndpointState) Validate(formats strfmt.Registry) error {
    86  	var res []error
    87  
    88  	// value enum
    89  	if err := m.validateEndpointStateEnum("", "body", m); err != nil {
    90  		return err
    91  	}
    92  
    93  	if len(res) > 0 {
    94  		return errors.CompositeValidationError(res...)
    95  	}
    96  	return nil
    97  }
    98  
    99  // ContextValidate validates this endpoint state based on context it is used
   100  func (m EndpointState) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   101  	return nil
   102  }