github.com/kubearmor/cilium@v1.6.12/api/v1/models/endpoint_policy_enabled.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/validate"
    15  )
    16  
    17  // EndpointPolicyEnabled Whether policy enforcement is enabled (ingress, egress, both or none)
    18  // swagger:model EndpointPolicyEnabled
    19  type EndpointPolicyEnabled string
    20  
    21  const (
    22  
    23  	// EndpointPolicyEnabledNone captures enum value "none"
    24  	EndpointPolicyEnabledNone EndpointPolicyEnabled = "none"
    25  
    26  	// EndpointPolicyEnabledIngress captures enum value "ingress"
    27  	EndpointPolicyEnabledIngress EndpointPolicyEnabled = "ingress"
    28  
    29  	// EndpointPolicyEnabledEgress captures enum value "egress"
    30  	EndpointPolicyEnabledEgress EndpointPolicyEnabled = "egress"
    31  
    32  	// EndpointPolicyEnabledBoth captures enum value "both"
    33  	EndpointPolicyEnabledBoth EndpointPolicyEnabled = "both"
    34  )
    35  
    36  // for schema
    37  var endpointPolicyEnabledEnum []interface{}
    38  
    39  func init() {
    40  	var res []EndpointPolicyEnabled
    41  	if err := json.Unmarshal([]byte(`["none","ingress","egress","both"]`), &res); err != nil {
    42  		panic(err)
    43  	}
    44  	for _, v := range res {
    45  		endpointPolicyEnabledEnum = append(endpointPolicyEnabledEnum, v)
    46  	}
    47  }
    48  
    49  func (m EndpointPolicyEnabled) validateEndpointPolicyEnabledEnum(path, location string, value EndpointPolicyEnabled) error {
    50  	if err := validate.Enum(path, location, value, endpointPolicyEnabledEnum); err != nil {
    51  		return err
    52  	}
    53  	return nil
    54  }
    55  
    56  // Validate validates this endpoint policy enabled
    57  func (m EndpointPolicyEnabled) Validate(formats strfmt.Registry) error {
    58  	var res []error
    59  
    60  	// value enum
    61  	if err := m.validateEndpointPolicyEnabledEnum("", "body", m); err != nil {
    62  		return err
    63  	}
    64  
    65  	if len(res) > 0 {
    66  		return errors.CompositeValidationError(res...)
    67  	}
    68  	return nil
    69  }