github.com/kubearmor/cilium@v1.6.12/api/v1/models/k8s_status.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package models
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"encoding/json"
    10  
    11  	strfmt "github.com/go-openapi/strfmt"
    12  
    13  	"github.com/go-openapi/errors"
    14  	"github.com/go-openapi/swag"
    15  	"github.com/go-openapi/validate"
    16  )
    17  
    18  // K8sStatus Status of Kubernetes integration
    19  // swagger:model K8sStatus
    20  // +k8s:deepcopy-gen=true
    21  type K8sStatus struct {
    22  
    23  	// k8s api versions
    24  	K8sAPIVersions []string `json:"k8s-api-versions"`
    25  
    26  	// Human readable status/error/warning message
    27  	Msg string `json:"msg,omitempty"`
    28  
    29  	// State the component is in
    30  	// Enum: [Ok Warning Failure Disabled]
    31  	State string `json:"state,omitempty"`
    32  }
    33  
    34  // Validate validates this k8s status
    35  func (m *K8sStatus) Validate(formats strfmt.Registry) error {
    36  	var res []error
    37  
    38  	if err := m.validateState(formats); err != nil {
    39  		res = append(res, err)
    40  	}
    41  
    42  	if len(res) > 0 {
    43  		return errors.CompositeValidationError(res...)
    44  	}
    45  	return nil
    46  }
    47  
    48  var k8sStatusTypeStatePropEnum []interface{}
    49  
    50  func init() {
    51  	var res []string
    52  	if err := json.Unmarshal([]byte(`["Ok","Warning","Failure","Disabled"]`), &res); err != nil {
    53  		panic(err)
    54  	}
    55  	for _, v := range res {
    56  		k8sStatusTypeStatePropEnum = append(k8sStatusTypeStatePropEnum, v)
    57  	}
    58  }
    59  
    60  const (
    61  
    62  	// K8sStatusStateOk captures enum value "Ok"
    63  	K8sStatusStateOk string = "Ok"
    64  
    65  	// K8sStatusStateWarning captures enum value "Warning"
    66  	K8sStatusStateWarning string = "Warning"
    67  
    68  	// K8sStatusStateFailure captures enum value "Failure"
    69  	K8sStatusStateFailure string = "Failure"
    70  
    71  	// K8sStatusStateDisabled captures enum value "Disabled"
    72  	K8sStatusStateDisabled string = "Disabled"
    73  )
    74  
    75  // prop value enum
    76  func (m *K8sStatus) validateStateEnum(path, location string, value string) error {
    77  	if err := validate.Enum(path, location, value, k8sStatusTypeStatePropEnum); err != nil {
    78  		return err
    79  	}
    80  	return nil
    81  }
    82  
    83  func (m *K8sStatus) validateState(formats strfmt.Registry) error {
    84  
    85  	if swag.IsZero(m.State) { // not required
    86  		return nil
    87  	}
    88  
    89  	// value enum
    90  	if err := m.validateStateEnum("state", "body", m.State); err != nil {
    91  		return err
    92  	}
    93  
    94  	return nil
    95  }
    96  
    97  // MarshalBinary interface implementation
    98  func (m *K8sStatus) MarshalBinary() ([]byte, error) {
    99  	if m == nil {
   100  		return nil, nil
   101  	}
   102  	return swag.WriteJSON(m)
   103  }
   104  
   105  // UnmarshalBinary interface implementation
   106  func (m *K8sStatus) UnmarshalBinary(b []byte) error {
   107  	var res K8sStatus
   108  	if err := swag.ReadJSON(b, &res); err != nil {
   109  		return err
   110  	}
   111  	*m = res
   112  	return nil
   113  }