github.com/cilium/cilium@v1.16.2/api/v1/models/endpoint_health_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/validate"
    18  )
    19  
    20  // EndpointHealthStatus A common set of statuses for endpoint health * “OK“ = All components operational * “Bootstrap“ = This component is being created * “Pending“ = A change is being processed to be applied * “Warning“ = This component is not applying up-to-date policies (but is still applying the previous version) * “Failure“ = An error has occurred and no policy is being applied * “Disabled“ = This endpoint is disabled and will not handle traffic
    21  //
    22  // swagger:model EndpointHealthStatus
    23  type EndpointHealthStatus string
    24  
    25  func NewEndpointHealthStatus(value EndpointHealthStatus) *EndpointHealthStatus {
    26  	return &value
    27  }
    28  
    29  // Pointer returns a pointer to a freshly-allocated EndpointHealthStatus.
    30  func (m EndpointHealthStatus) Pointer() *EndpointHealthStatus {
    31  	return &m
    32  }
    33  
    34  const (
    35  
    36  	// EndpointHealthStatusOK captures enum value "OK"
    37  	EndpointHealthStatusOK EndpointHealthStatus = "OK"
    38  
    39  	// EndpointHealthStatusBootstrap captures enum value "Bootstrap"
    40  	EndpointHealthStatusBootstrap EndpointHealthStatus = "Bootstrap"
    41  
    42  	// EndpointHealthStatusPending captures enum value "Pending"
    43  	EndpointHealthStatusPending EndpointHealthStatus = "Pending"
    44  
    45  	// EndpointHealthStatusWarning captures enum value "Warning"
    46  	EndpointHealthStatusWarning EndpointHealthStatus = "Warning"
    47  
    48  	// EndpointHealthStatusFailure captures enum value "Failure"
    49  	EndpointHealthStatusFailure EndpointHealthStatus = "Failure"
    50  
    51  	// EndpointHealthStatusDisabled captures enum value "Disabled"
    52  	EndpointHealthStatusDisabled EndpointHealthStatus = "Disabled"
    53  )
    54  
    55  // for schema
    56  var endpointHealthStatusEnum []interface{}
    57  
    58  func init() {
    59  	var res []EndpointHealthStatus
    60  	if err := json.Unmarshal([]byte(`["OK","Bootstrap","Pending","Warning","Failure","Disabled"]`), &res); err != nil {
    61  		panic(err)
    62  	}
    63  	for _, v := range res {
    64  		endpointHealthStatusEnum = append(endpointHealthStatusEnum, v)
    65  	}
    66  }
    67  
    68  func (m EndpointHealthStatus) validateEndpointHealthStatusEnum(path, location string, value EndpointHealthStatus) error {
    69  	if err := validate.EnumCase(path, location, value, endpointHealthStatusEnum, true); err != nil {
    70  		return err
    71  	}
    72  	return nil
    73  }
    74  
    75  // Validate validates this endpoint health status
    76  func (m EndpointHealthStatus) Validate(formats strfmt.Registry) error {
    77  	var res []error
    78  
    79  	// value enum
    80  	if err := m.validateEndpointHealthStatusEnum("", "body", m); err != nil {
    81  		return err
    82  	}
    83  
    84  	if len(res) > 0 {
    85  		return errors.CompositeValidationError(res...)
    86  	}
    87  	return nil
    88  }
    89  
    90  // ContextValidate validates this endpoint health status based on context it is used
    91  func (m EndpointHealthStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    92  	return nil
    93  }