github.com/kubearmor/cilium@v1.6.12/api/v1/models/identity.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 strfmt "github.com/go-openapi/strfmt" 10 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/swag" 13 ) 14 15 // Identity Security identity 16 // swagger:model Identity 17 type Identity struct { 18 19 // Unique identifier 20 ID int64 `json:"id,omitempty"` 21 22 // Labels describing the identity 23 Labels Labels `json:"labels,omitempty"` 24 25 // SHA256 of labels 26 LabelsSHA256 string `json:"labelsSHA256,omitempty"` 27 } 28 29 // Validate validates this identity 30 func (m *Identity) Validate(formats strfmt.Registry) error { 31 var res []error 32 33 if err := m.validateLabels(formats); err != nil { 34 res = append(res, err) 35 } 36 37 if len(res) > 0 { 38 return errors.CompositeValidationError(res...) 39 } 40 return nil 41 } 42 43 func (m *Identity) validateLabels(formats strfmt.Registry) error { 44 45 if swag.IsZero(m.Labels) { // not required 46 return nil 47 } 48 49 if err := m.Labels.Validate(formats); err != nil { 50 if ve, ok := err.(*errors.Validation); ok { 51 return ve.ValidateName("labels") 52 } 53 return err 54 } 55 56 return nil 57 } 58 59 // MarshalBinary interface implementation 60 func (m *Identity) MarshalBinary() ([]byte, error) { 61 if m == nil { 62 return nil, nil 63 } 64 return swag.WriteJSON(m) 65 } 66 67 // UnmarshalBinary interface implementation 68 func (m *Identity) UnmarshalBinary(b []byte) error { 69 var res Identity 70 if err := swag.ReadJSON(b, &res); err != nil { 71 return err 72 } 73 *m = res 74 return nil 75 }