github.com/cilium/cilium@v1.16.2/api/v1/models/node_id.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  
    14  	"github.com/go-openapi/errors"
    15  	"github.com/go-openapi/strfmt"
    16  	"github.com/go-openapi/swag"
    17  	"github.com/go-openapi/validate"
    18  )
    19  
    20  // NodeID Node ID with associated node IP addresses
    21  //
    22  // swagger:model NodeID
    23  type NodeID struct {
    24  
    25  	// ID allocated by the agent for the node
    26  	// Required: true
    27  	ID *int64 `json:"id"`
    28  
    29  	// IP addresses of the node associated with the ID in the agent
    30  	// Required: true
    31  	Ips []string `json:"ips"`
    32  }
    33  
    34  // Validate validates this node ID
    35  func (m *NodeID) Validate(formats strfmt.Registry) error {
    36  	var res []error
    37  
    38  	if err := m.validateID(formats); err != nil {
    39  		res = append(res, err)
    40  	}
    41  
    42  	if err := m.validateIps(formats); err != nil {
    43  		res = append(res, err)
    44  	}
    45  
    46  	if len(res) > 0 {
    47  		return errors.CompositeValidationError(res...)
    48  	}
    49  	return nil
    50  }
    51  
    52  func (m *NodeID) validateID(formats strfmt.Registry) error {
    53  
    54  	if err := validate.Required("id", "body", m.ID); err != nil {
    55  		return err
    56  	}
    57  
    58  	return nil
    59  }
    60  
    61  func (m *NodeID) validateIps(formats strfmt.Registry) error {
    62  
    63  	if err := validate.Required("ips", "body", m.Ips); err != nil {
    64  		return err
    65  	}
    66  
    67  	return nil
    68  }
    69  
    70  // ContextValidate validates this node ID based on context it is used
    71  func (m *NodeID) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    72  	return nil
    73  }
    74  
    75  // MarshalBinary interface implementation
    76  func (m *NodeID) MarshalBinary() ([]byte, error) {
    77  	if m == nil {
    78  		return nil, nil
    79  	}
    80  	return swag.WriteJSON(m)
    81  }
    82  
    83  // UnmarshalBinary interface implementation
    84  func (m *NodeID) UnmarshalBinary(b []byte) error {
    85  	var res NodeID
    86  	if err := swag.ReadJSON(b, &res); err != nil {
    87  		return err
    88  	}
    89  	*m = res
    90  	return nil
    91  }