2020-07-01 18:03:22 -07:00
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
2023-02-06 22:32:49 -06:00
// Copyright (c) 2023 MinIO, Inc.
2020-07-01 18:03:22 -07:00
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
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 (
2021-06-08 12:35:39 -07:00
"context"
2020-07-13 20:36:27 -07:00
"github.com/go-openapi/errors"
2020-07-01 18:03:22 -07:00
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
2020-07-13 20:36:27 -07:00
"github.com/go-openapi/validate"
2020-07-01 18:03:22 -07:00
)
2020-12-07 09:49:51 -06:00
// Pool pool
2020-07-01 18:03:22 -07:00
//
2020-12-07 09:49:51 -06:00
// swagger:model pool
type Pool struct {
2020-07-01 18:03:22 -07:00
2020-07-29 01:01:17 -07:00
// affinity
2020-12-07 09:49:51 -06:00
Affinity * PoolAffinity ` json:"affinity,omitempty" `
2020-07-29 01:01:17 -07:00
2020-07-01 18:03:22 -07:00
// name
2020-07-25 14:38:16 -07:00
Name string ` json:"name,omitempty" `
2020-07-01 18:03:22 -07:00
2020-07-29 01:01:17 -07:00
// NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
NodeSelector map [ string ] string ` json:"node_selector,omitempty" `
// resources
2020-12-07 09:49:51 -06:00
Resources * PoolResources ` json:"resources,omitempty" `
2020-07-29 01:01:17 -07:00
2023-01-12 14:27:53 -08:00
// runtime class name
RuntimeClassName string ` json:"runtimeClassName,omitempty" `
2021-10-19 09:42:36 -07:00
// security context
SecurityContext * SecurityContext ` json:"securityContext,omitempty" `
2020-07-01 18:03:22 -07:00
// servers
2020-07-13 20:36:27 -07:00
// Required: true
Servers * int64 ` json:"servers" `
2020-07-25 14:38:16 -07:00
2020-07-29 01:01:17 -07:00
// tolerations
2020-12-07 09:49:51 -06:00
Tolerations PoolTolerations ` json:"tolerations,omitempty" `
2020-07-29 01:01:17 -07:00
2020-07-25 14:38:16 -07:00
// volume configuration
// Required: true
2020-12-07 09:49:51 -06:00
VolumeConfiguration * PoolVolumeConfiguration ` json:"volume_configuration" `
2020-07-25 14:38:16 -07:00
// volumes per server
// Required: true
VolumesPerServer * int32 ` json:"volumes_per_server" `
2020-07-01 18:03:22 -07:00
}
2020-12-07 09:49:51 -06:00
// Validate validates this pool
func ( m * Pool ) Validate ( formats strfmt . Registry ) error {
2020-07-13 20:36:27 -07:00
var res [ ] error
2020-07-29 01:01:17 -07:00
if err := m . validateAffinity ( formats ) ; err != nil {
res = append ( res , err )
}
if err := m . validateResources ( formats ) ; err != nil {
res = append ( res , err )
}
2021-10-19 09:42:36 -07:00
if err := m . validateSecurityContext ( formats ) ; err != nil {
res = append ( res , err )
}
2020-07-25 14:38:16 -07:00
if err := m . validateServers ( formats ) ; err != nil {
2020-07-13 20:36:27 -07:00
res = append ( res , err )
}
2020-07-29 01:01:17 -07:00
if err := m . validateTolerations ( formats ) ; err != nil {
res = append ( res , err )
}
2020-07-25 14:38:16 -07:00
if err := m . validateVolumeConfiguration ( formats ) ; err != nil {
res = append ( res , err )
}
if err := m . validateVolumesPerServer ( formats ) ; err != nil {
2020-07-13 20:36:27 -07:00
res = append ( res , err )
}
if len ( res ) > 0 {
return errors . CompositeValidationError ( res ... )
}
return nil
}
2020-12-07 09:49:51 -06:00
func ( m * Pool ) validateAffinity ( formats strfmt . Registry ) error {
2020-07-29 01:01:17 -07:00
if swag . IsZero ( m . Affinity ) { // not required
return nil
}
if m . Affinity != nil {
if err := m . Affinity . Validate ( formats ) ; err != nil {
if ve , ok := err . ( * errors . Validation ) ; ok {
return ve . ValidateName ( "affinity" )
2022-01-12 18:59:14 -08:00
} else if ce , ok := err . ( * errors . CompositeError ) ; ok {
return ce . ValidateName ( "affinity" )
2020-07-29 01:01:17 -07:00
}
return err
}
}
return nil
}
2020-12-07 09:49:51 -06:00
func ( m * Pool ) validateResources ( formats strfmt . Registry ) error {
2020-07-29 01:01:17 -07:00
if swag . IsZero ( m . Resources ) { // not required
return nil
}
if m . Resources != nil {
if err := m . Resources . Validate ( formats ) ; err != nil {
if ve , ok := err . ( * errors . Validation ) ; ok {
return ve . ValidateName ( "resources" )
2022-01-12 18:59:14 -08:00
} else if ce , ok := err . ( * errors . CompositeError ) ; ok {
return ce . ValidateName ( "resources" )
2020-07-29 01:01:17 -07:00
}
return err
}
}
return nil
}
2021-10-19 09:42:36 -07:00
func ( m * Pool ) validateSecurityContext ( formats strfmt . Registry ) error {
if swag . IsZero ( m . SecurityContext ) { // not required
return nil
}
if m . SecurityContext != nil {
if err := m . SecurityContext . Validate ( formats ) ; err != nil {
if ve , ok := err . ( * errors . Validation ) ; ok {
return ve . ValidateName ( "securityContext" )
2022-01-12 18:59:14 -08:00
} else if ce , ok := err . ( * errors . CompositeError ) ; ok {
return ce . ValidateName ( "securityContext" )
2021-10-19 09:42:36 -07:00
}
return err
}
}
return nil
}
2020-12-07 09:49:51 -06:00
func ( m * Pool ) validateServers ( formats strfmt . Registry ) error {
2020-07-13 20:36:27 -07:00
2020-07-25 14:38:16 -07:00
if err := validate . Required ( "servers" , "body" , m . Servers ) ; err != nil {
2020-07-13 20:36:27 -07:00
return err
}
return nil
}
2020-12-07 09:49:51 -06:00
func ( m * Pool ) validateTolerations ( formats strfmt . Registry ) error {
2020-07-29 01:01:17 -07:00
if swag . IsZero ( m . Tolerations ) { // not required
return nil
}
if err := m . Tolerations . Validate ( formats ) ; err != nil {
if ve , ok := err . ( * errors . Validation ) ; ok {
return ve . ValidateName ( "tolerations" )
2022-01-12 18:59:14 -08:00
} else if ce , ok := err . ( * errors . CompositeError ) ; ok {
return ce . ValidateName ( "tolerations" )
2020-07-29 01:01:17 -07:00
}
return err
}
return nil
}
2020-12-07 09:49:51 -06:00
func ( m * Pool ) validateVolumeConfiguration ( formats strfmt . Registry ) error {
2020-07-13 20:36:27 -07:00
2020-07-25 14:38:16 -07:00
if err := validate . Required ( "volume_configuration" , "body" , m . VolumeConfiguration ) ; err != nil {
return err
}
if m . VolumeConfiguration != nil {
if err := m . VolumeConfiguration . Validate ( formats ) ; err != nil {
if ve , ok := err . ( * errors . Validation ) ; ok {
return ve . ValidateName ( "volume_configuration" )
2022-01-12 18:59:14 -08:00
} else if ce , ok := err . ( * errors . CompositeError ) ; ok {
return ce . ValidateName ( "volume_configuration" )
2020-07-25 14:38:16 -07:00
}
return err
}
}
return nil
}
2020-12-07 09:49:51 -06:00
func ( m * Pool ) validateVolumesPerServer ( formats strfmt . Registry ) error {
2020-07-25 14:38:16 -07:00
if err := validate . Required ( "volumes_per_server" , "body" , m . VolumesPerServer ) ; err != nil {
2020-07-13 20:36:27 -07:00
return err
}
2020-07-01 18:03:22 -07:00
return nil
}
2021-06-08 12:35:39 -07:00
// ContextValidate validate this pool based on the context it is used
func ( m * Pool ) ContextValidate ( ctx context . Context , formats strfmt . Registry ) error {
var res [ ] error
if err := m . contextValidateAffinity ( ctx , formats ) ; err != nil {
res = append ( res , err )
}
if err := m . contextValidateResources ( ctx , formats ) ; err != nil {
res = append ( res , err )
}
2021-10-19 09:42:36 -07:00
if err := m . contextValidateSecurityContext ( ctx , formats ) ; err != nil {
res = append ( res , err )
}
2021-06-08 12:35:39 -07:00
if err := m . contextValidateTolerations ( ctx , formats ) ; err != nil {
res = append ( res , err )
}
if err := m . contextValidateVolumeConfiguration ( ctx , formats ) ; err != nil {
res = append ( res , err )
}
if len ( res ) > 0 {
return errors . CompositeValidationError ( res ... )
}
return nil
}
func ( m * Pool ) contextValidateAffinity ( ctx context . Context , formats strfmt . Registry ) error {
if m . Affinity != nil {
if err := m . Affinity . ContextValidate ( ctx , formats ) ; err != nil {
if ve , ok := err . ( * errors . Validation ) ; ok {
return ve . ValidateName ( "affinity" )
2022-01-12 18:59:14 -08:00
} else if ce , ok := err . ( * errors . CompositeError ) ; ok {
return ce . ValidateName ( "affinity" )
2021-06-08 12:35:39 -07:00
}
return err
}
}
return nil
}
func ( m * Pool ) contextValidateResources ( ctx context . Context , formats strfmt . Registry ) error {
if m . Resources != nil {
if err := m . Resources . ContextValidate ( ctx , formats ) ; err != nil {
if ve , ok := err . ( * errors . Validation ) ; ok {
return ve . ValidateName ( "resources" )
2022-01-12 18:59:14 -08:00
} else if ce , ok := err . ( * errors . CompositeError ) ; ok {
return ce . ValidateName ( "resources" )
2021-06-08 12:35:39 -07:00
}
return err
}
}
return nil
}
2021-10-19 09:42:36 -07:00
func ( m * Pool ) contextValidateSecurityContext ( ctx context . Context , formats strfmt . Registry ) error {
if m . SecurityContext != nil {
if err := m . SecurityContext . ContextValidate ( ctx , formats ) ; err != nil {
if ve , ok := err . ( * errors . Validation ) ; ok {
return ve . ValidateName ( "securityContext" )
2022-01-12 18:59:14 -08:00
} else if ce , ok := err . ( * errors . CompositeError ) ; ok {
return ce . ValidateName ( "securityContext" )
2021-10-19 09:42:36 -07:00
}
return err
}
}
return nil
}
2021-06-08 12:35:39 -07:00
func ( m * Pool ) contextValidateTolerations ( ctx context . Context , formats strfmt . Registry ) error {
if err := m . Tolerations . ContextValidate ( ctx , formats ) ; err != nil {
if ve , ok := err . ( * errors . Validation ) ; ok {
return ve . ValidateName ( "tolerations" )
2022-01-12 18:59:14 -08:00
} else if ce , ok := err . ( * errors . CompositeError ) ; ok {
return ce . ValidateName ( "tolerations" )
2021-06-08 12:35:39 -07:00
}
return err
}
return nil
}
func ( m * Pool ) contextValidateVolumeConfiguration ( ctx context . Context , formats strfmt . Registry ) error {
if m . VolumeConfiguration != nil {
if err := m . VolumeConfiguration . ContextValidate ( ctx , formats ) ; err != nil {
if ve , ok := err . ( * errors . Validation ) ; ok {
return ve . ValidateName ( "volume_configuration" )
2022-01-12 18:59:14 -08:00
} else if ce , ok := err . ( * errors . CompositeError ) ; ok {
return ce . ValidateName ( "volume_configuration" )
2021-06-08 12:35:39 -07:00
}
return err
}
}
return nil
}
2020-07-01 18:03:22 -07:00
// MarshalBinary interface implementation
2020-12-07 09:49:51 -06:00
func ( m * Pool ) MarshalBinary ( ) ( [ ] byte , error ) {
2020-07-01 18:03:22 -07:00
if m == nil {
return nil , nil
}
return swag . WriteJSON ( m )
}
// UnmarshalBinary interface implementation
2020-12-07 09:49:51 -06:00
func ( m * Pool ) UnmarshalBinary ( b [ ] byte ) error {
var res Pool
2020-07-01 18:03:22 -07:00
if err := swag . ReadJSON ( b , & res ) ; err != nil {
return err
}
* m = res
return nil
}
2020-07-25 14:38:16 -07:00
2020-12-07 09:49:51 -06:00
// PoolVolumeConfiguration pool volume configuration
2020-07-25 14:38:16 -07:00
//
2020-12-07 09:49:51 -06:00
// swagger:model PoolVolumeConfiguration
type PoolVolumeConfiguration struct {
2020-07-25 14:38:16 -07:00
2020-09-17 06:44:16 -07:00
// annotations
Annotations map [ string ] string ` json:"annotations,omitempty" `
2020-08-20 22:46:07 -07:00
// labels
Labels map [ string ] string ` json:"labels,omitempty" `
2020-07-25 14:38:16 -07:00
// size
// Required: true
Size * int64 ` json:"size" `
// storage class name
StorageClassName string ` json:"storage_class_name,omitempty" `
}
2020-12-07 09:49:51 -06:00
// Validate validates this pool volume configuration
func ( m * PoolVolumeConfiguration ) Validate ( formats strfmt . Registry ) error {
2020-07-25 14:38:16 -07:00
var res [ ] error
if err := m . validateSize ( formats ) ; err != nil {
res = append ( res , err )
}
if len ( res ) > 0 {
return errors . CompositeValidationError ( res ... )
}
return nil
}
2020-12-07 09:49:51 -06:00
func ( m * PoolVolumeConfiguration ) validateSize ( formats strfmt . Registry ) error {
2020-07-25 14:38:16 -07:00
if err := validate . Required ( "volume_configuration" + "." + "size" , "body" , m . Size ) ; err != nil {
return err
}
return nil
}
2021-06-08 12:35:39 -07:00
// ContextValidate validates this pool volume configuration based on context it is used
func ( m * PoolVolumeConfiguration ) ContextValidate ( ctx context . Context , formats strfmt . Registry ) error {
return nil
}
2020-07-25 14:38:16 -07:00
// MarshalBinary interface implementation
2020-12-07 09:49:51 -06:00
func ( m * PoolVolumeConfiguration ) MarshalBinary ( ) ( [ ] byte , error ) {
2020-07-25 14:38:16 -07:00
if m == nil {
return nil , nil
}
return swag . WriteJSON ( m )
}
// UnmarshalBinary interface implementation
2020-12-07 09:49:51 -06:00
func ( m * PoolVolumeConfiguration ) UnmarshalBinary ( b [ ] byte ) error {
var res PoolVolumeConfiguration
2020-07-25 14:38:16 -07:00
if err := swag . ReadJSON ( b , & res ) ; err != nil {
return err
}
* m = res
return nil
}