github.com/kubearmor/cilium@v1.6.12/api/v1/models/ipvlan_configuration.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  // IpvlanConfiguration Setup for datapath when operating in ipvlan mode.
    19  // swagger:model IpvlanConfiguration
    20  type IpvlanConfiguration struct {
    21  
    22  	// Workload facing ipvlan master device ifindex.
    23  	MasterDeviceIndex int64 `json:"masterDeviceIndex,omitempty"`
    24  
    25  	// Mode in which ipvlan setup operates.
    26  	// Enum: [L3 L3S]
    27  	OperationMode string `json:"operationMode,omitempty"`
    28  }
    29  
    30  // Validate validates this ipvlan configuration
    31  func (m *IpvlanConfiguration) Validate(formats strfmt.Registry) error {
    32  	var res []error
    33  
    34  	if err := m.validateOperationMode(formats); err != nil {
    35  		res = append(res, err)
    36  	}
    37  
    38  	if len(res) > 0 {
    39  		return errors.CompositeValidationError(res...)
    40  	}
    41  	return nil
    42  }
    43  
    44  var ipvlanConfigurationTypeOperationModePropEnum []interface{}
    45  
    46  func init() {
    47  	var res []string
    48  	if err := json.Unmarshal([]byte(`["L3","L3S"]`), &res); err != nil {
    49  		panic(err)
    50  	}
    51  	for _, v := range res {
    52  		ipvlanConfigurationTypeOperationModePropEnum = append(ipvlanConfigurationTypeOperationModePropEnum, v)
    53  	}
    54  }
    55  
    56  const (
    57  
    58  	// IpvlanConfigurationOperationModeL3 captures enum value "L3"
    59  	IpvlanConfigurationOperationModeL3 string = "L3"
    60  
    61  	// IpvlanConfigurationOperationModeL3S captures enum value "L3S"
    62  	IpvlanConfigurationOperationModeL3S string = "L3S"
    63  )
    64  
    65  // prop value enum
    66  func (m *IpvlanConfiguration) validateOperationModeEnum(path, location string, value string) error {
    67  	if err := validate.Enum(path, location, value, ipvlanConfigurationTypeOperationModePropEnum); err != nil {
    68  		return err
    69  	}
    70  	return nil
    71  }
    72  
    73  func (m *IpvlanConfiguration) validateOperationMode(formats strfmt.Registry) error {
    74  
    75  	if swag.IsZero(m.OperationMode) { // not required
    76  		return nil
    77  	}
    78  
    79  	// value enum
    80  	if err := m.validateOperationModeEnum("operationMode", "body", m.OperationMode); err != nil {
    81  		return err
    82  	}
    83  
    84  	return nil
    85  }
    86  
    87  // MarshalBinary interface implementation
    88  func (m *IpvlanConfiguration) MarshalBinary() ([]byte, error) {
    89  	if m == nil {
    90  		return nil, nil
    91  	}
    92  	return swag.WriteJSON(m)
    93  }
    94  
    95  // UnmarshalBinary interface implementation
    96  func (m *IpvlanConfiguration) UnmarshalBinary(b []byte) error {
    97  	var res IpvlanConfiguration
    98  	if err := swag.ReadJSON(b, &res); err != nil {
    99  		return err
   100  	}
   101  	*m = res
   102  	return nil
   103  }