github.com/cilium/cilium@v1.16.2/api/v1/models/endpoint_policy_enabled.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  // EndpointPolicyEnabled Whether policy enforcement is enabled (ingress, egress, both or none)
    21  //
    22  // swagger:model EndpointPolicyEnabled
    23  type EndpointPolicyEnabled string
    24  
    25  func NewEndpointPolicyEnabled(value EndpointPolicyEnabled) *EndpointPolicyEnabled {
    26  	return &value
    27  }
    28  
    29  // Pointer returns a pointer to a freshly-allocated EndpointPolicyEnabled.
    30  func (m EndpointPolicyEnabled) Pointer() *EndpointPolicyEnabled {
    31  	return &m
    32  }
    33  
    34  const (
    35  
    36  	// EndpointPolicyEnabledNone captures enum value "none"
    37  	EndpointPolicyEnabledNone EndpointPolicyEnabled = "none"
    38  
    39  	// EndpointPolicyEnabledIngress captures enum value "ingress"
    40  	EndpointPolicyEnabledIngress EndpointPolicyEnabled = "ingress"
    41  
    42  	// EndpointPolicyEnabledEgress captures enum value "egress"
    43  	EndpointPolicyEnabledEgress EndpointPolicyEnabled = "egress"
    44  
    45  	// EndpointPolicyEnabledBoth captures enum value "both"
    46  	EndpointPolicyEnabledBoth EndpointPolicyEnabled = "both"
    47  
    48  	// EndpointPolicyEnabledAuditDashIngress captures enum value "audit-ingress"
    49  	EndpointPolicyEnabledAuditDashIngress EndpointPolicyEnabled = "audit-ingress"
    50  
    51  	// EndpointPolicyEnabledAuditDashEgress captures enum value "audit-egress"
    52  	EndpointPolicyEnabledAuditDashEgress EndpointPolicyEnabled = "audit-egress"
    53  
    54  	// EndpointPolicyEnabledAuditDashBoth captures enum value "audit-both"
    55  	EndpointPolicyEnabledAuditDashBoth EndpointPolicyEnabled = "audit-both"
    56  )
    57  
    58  // for schema
    59  var endpointPolicyEnabledEnum []interface{}
    60  
    61  func init() {
    62  	var res []EndpointPolicyEnabled
    63  	if err := json.Unmarshal([]byte(`["none","ingress","egress","both","audit-ingress","audit-egress","audit-both"]`), &res); err != nil {
    64  		panic(err)
    65  	}
    66  	for _, v := range res {
    67  		endpointPolicyEnabledEnum = append(endpointPolicyEnabledEnum, v)
    68  	}
    69  }
    70  
    71  func (m EndpointPolicyEnabled) validateEndpointPolicyEnabledEnum(path, location string, value EndpointPolicyEnabled) error {
    72  	if err := validate.EnumCase(path, location, value, endpointPolicyEnabledEnum, true); err != nil {
    73  		return err
    74  	}
    75  	return nil
    76  }
    77  
    78  // Validate validates this endpoint policy enabled
    79  func (m EndpointPolicyEnabled) Validate(formats strfmt.Registry) error {
    80  	var res []error
    81  
    82  	// value enum
    83  	if err := m.validateEndpointPolicyEnabledEnum("", "body", m); err != nil {
    84  		return err
    85  	}
    86  
    87  	if len(res) > 0 {
    88  		return errors.CompositeValidationError(res...)
    89  	}
    90  	return nil
    91  }
    92  
    93  // ContextValidate validates this endpoint policy enabled based on context it is used
    94  func (m EndpointPolicyEnabled) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    95  	return nil
    96  }