// Code generated by go-swagger; DO NOT EDIT. package models // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "context" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ContainerList List of containers info // Example: {"containers":[{"attribute":[{"key":"Timestamp","value":"1648810072"},{"key":"Name","value":"container"}],"basicAcl":"0x1fbf9fff","containerId":"5HZTn5qkRnmgSz9gSrw22CEdPPk6nQhkwf2Mgzyvkikv","containerName":"container","ownerId":"NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM","placementPolicy":"REP 2","version":"2.11"},{"attribute":[{"key":"Name","value":"container2"}],"basicAcl":"0x1fbf9fff","containerId":"FsE7HLQBBYc2WFJzuTXMcpspDEmwUxsD5YmNb2r25uUu","containerName":"container2","ownerId":"NbUgTSFvPmsRxmGeWpuuGeJUoRoi6PErcM","placementPolicy":"REP 1","version":"2.11"}],"size":2} // // swagger:model ContainerList type ContainerList struct { // containers // Required: true Containers []*ContainerInfo `json:"containers"` // size // Required: true Size *int64 `json:"size"` } // Validate validates this container list func (m *ContainerList) Validate(formats strfmt.Registry) error { var res []error if err := m.validateContainers(formats); err != nil { res = append(res, err) } if err := m.validateSize(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ContainerList) validateContainers(formats strfmt.Registry) error { if err := validate.Required("containers", "body", m.Containers); err != nil { return err } for i := 0; i < len(m.Containers); i++ { if swag.IsZero(m.Containers[i]) { // not required continue } if m.Containers[i] != nil { if err := m.Containers[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("containers" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("containers" + "." + strconv.Itoa(i)) } return err } } } return nil } func (m *ContainerList) validateSize(formats strfmt.Registry) error { if err := validate.Required("size", "body", m.Size); err != nil { return err } return nil } // ContextValidate validate this container list based on the context it is used func (m *ContainerList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateContainers(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *ContainerList) contextValidateContainers(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Containers); i++ { if m.Containers[i] != nil { if err := m.Containers[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("containers" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("containers" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *ContainerList) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *ContainerList) UnmarshalBinary(b []byte) error { var res ContainerList if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }