// Code generated by go-swagger; DO NOT EDIT.

package cluster

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"
	"encoding/json"
	"fmt"
	"io"
	"strconv"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// CreateClusterReader is a Reader for the CreateCluster structure.
type CreateClusterReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *CreateClusterReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewCreateClusterOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewCreateClusterBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewCreateClusterUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewCreateClusterForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewCreateClusterNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 429:
		result := NewCreateClusterTooManyRequests()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewCreateClusterInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewCreateClusterDefault(response.Code())
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		if response.Code()/100 == 2 {
			return result, nil
		}
		return nil, result
	}
}

// NewCreateClusterOK creates a CreateClusterOK with default headers values
func NewCreateClusterOK() *CreateClusterOK {
	return &CreateClusterOK{}
}

/*
CreateClusterOK describes a response with status code 200, with default header values.

A successful response.
*/
type CreateClusterOK struct {
	Payload *CreateClusterOKBody
}

// IsSuccess returns true when this create cluster o k response has a 2xx status code
func (o *CreateClusterOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this create cluster o k response has a 3xx status code
func (o *CreateClusterOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create cluster o k response has a 4xx status code
func (o *CreateClusterOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this create cluster o k response has a 5xx status code
func (o *CreateClusterOK) IsServerError() bool {
	return false
}

// IsCode returns true when this create cluster o k response a status code equal to that given
func (o *CreateClusterOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the create cluster o k response
func (o *CreateClusterOK) Code() int {
	return 200
}

func (o *CreateClusterOK) Error() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterOK  %+v", 200, o.Payload)
}

func (o *CreateClusterOK) String() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterOK  %+v", 200, o.Payload)
}

func (o *CreateClusterOK) GetPayload() *CreateClusterOKBody {
	return o.Payload
}

func (o *CreateClusterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(CreateClusterOKBody)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewCreateClusterBadRequest creates a CreateClusterBadRequest with default headers values
func NewCreateClusterBadRequest() *CreateClusterBadRequest {
	return &CreateClusterBadRequest{}
}

/*
CreateClusterBadRequest describes a response with status code 400, with default header values.

A request field is invalid.
*/
type CreateClusterBadRequest struct {
	Payload *CreateClusterBadRequestBody
}

// IsSuccess returns true when this create cluster bad request response has a 2xx status code
func (o *CreateClusterBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this create cluster bad request response has a 3xx status code
func (o *CreateClusterBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create cluster bad request response has a 4xx status code
func (o *CreateClusterBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this create cluster bad request response has a 5xx status code
func (o *CreateClusterBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this create cluster bad request response a status code equal to that given
func (o *CreateClusterBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the create cluster bad request response
func (o *CreateClusterBadRequest) Code() int {
	return 400
}

func (o *CreateClusterBadRequest) Error() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterBadRequest  %+v", 400, o.Payload)
}

func (o *CreateClusterBadRequest) String() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterBadRequest  %+v", 400, o.Payload)
}

func (o *CreateClusterBadRequest) GetPayload() *CreateClusterBadRequestBody {
	return o.Payload
}

func (o *CreateClusterBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(CreateClusterBadRequestBody)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewCreateClusterUnauthorized creates a CreateClusterUnauthorized with default headers values
func NewCreateClusterUnauthorized() *CreateClusterUnauthorized {
	return &CreateClusterUnauthorized{}
}

/*
CreateClusterUnauthorized describes a response with status code 401, with default header values.

The API key cannot be authenticated.
*/
type CreateClusterUnauthorized struct {
	Payload interface{}
}

// IsSuccess returns true when this create cluster unauthorized response has a 2xx status code
func (o *CreateClusterUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this create cluster unauthorized response has a 3xx status code
func (o *CreateClusterUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create cluster unauthorized response has a 4xx status code
func (o *CreateClusterUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this create cluster unauthorized response has a 5xx status code
func (o *CreateClusterUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this create cluster unauthorized response a status code equal to that given
func (o *CreateClusterUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the create cluster unauthorized response
func (o *CreateClusterUnauthorized) Code() int {
	return 401
}

func (o *CreateClusterUnauthorized) Error() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterUnauthorized  %+v", 401, o.Payload)
}

func (o *CreateClusterUnauthorized) String() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterUnauthorized  %+v", 401, o.Payload)
}

func (o *CreateClusterUnauthorized) GetPayload() interface{} {
	return o.Payload
}

func (o *CreateClusterUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	// response payload
	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewCreateClusterForbidden creates a CreateClusterForbidden with default headers values
func NewCreateClusterForbidden() *CreateClusterForbidden {
	return &CreateClusterForbidden{}
}

/*
CreateClusterForbidden describes a response with status code 403, with default header values.

The API key does not have permission to access the resource.
*/
type CreateClusterForbidden struct {
	Payload *CreateClusterForbiddenBody
}

// IsSuccess returns true when this create cluster forbidden response has a 2xx status code
func (o *CreateClusterForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this create cluster forbidden response has a 3xx status code
func (o *CreateClusterForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create cluster forbidden response has a 4xx status code
func (o *CreateClusterForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this create cluster forbidden response has a 5xx status code
func (o *CreateClusterForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this create cluster forbidden response a status code equal to that given
func (o *CreateClusterForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the create cluster forbidden response
func (o *CreateClusterForbidden) Code() int {
	return 403
}

func (o *CreateClusterForbidden) Error() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterForbidden  %+v", 403, o.Payload)
}

func (o *CreateClusterForbidden) String() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterForbidden  %+v", 403, o.Payload)
}

func (o *CreateClusterForbidden) GetPayload() *CreateClusterForbiddenBody {
	return o.Payload
}

func (o *CreateClusterForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(CreateClusterForbiddenBody)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewCreateClusterNotFound creates a CreateClusterNotFound with default headers values
func NewCreateClusterNotFound() *CreateClusterNotFound {
	return &CreateClusterNotFound{}
}

/*
CreateClusterNotFound describes a response with status code 404, with default header values.

The requested resource does not exist.
*/
type CreateClusterNotFound struct {
	Payload *CreateClusterNotFoundBody
}

// IsSuccess returns true when this create cluster not found response has a 2xx status code
func (o *CreateClusterNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this create cluster not found response has a 3xx status code
func (o *CreateClusterNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create cluster not found response has a 4xx status code
func (o *CreateClusterNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this create cluster not found response has a 5xx status code
func (o *CreateClusterNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this create cluster not found response a status code equal to that given
func (o *CreateClusterNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the create cluster not found response
func (o *CreateClusterNotFound) Code() int {
	return 404
}

func (o *CreateClusterNotFound) Error() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterNotFound  %+v", 404, o.Payload)
}

func (o *CreateClusterNotFound) String() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterNotFound  %+v", 404, o.Payload)
}

func (o *CreateClusterNotFound) GetPayload() *CreateClusterNotFoundBody {
	return o.Payload
}

func (o *CreateClusterNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(CreateClusterNotFoundBody)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewCreateClusterTooManyRequests creates a CreateClusterTooManyRequests with default headers values
func NewCreateClusterTooManyRequests() *CreateClusterTooManyRequests {
	return &CreateClusterTooManyRequests{}
}

/*
CreateClusterTooManyRequests describes a response with status code 429, with default header values.

You have exceed the rate limit.
*/
type CreateClusterTooManyRequests struct {
	Payload *CreateClusterTooManyRequestsBody
}

// IsSuccess returns true when this create cluster too many requests response has a 2xx status code
func (o *CreateClusterTooManyRequests) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this create cluster too many requests response has a 3xx status code
func (o *CreateClusterTooManyRequests) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create cluster too many requests response has a 4xx status code
func (o *CreateClusterTooManyRequests) IsClientError() bool {
	return true
}

// IsServerError returns true when this create cluster too many requests response has a 5xx status code
func (o *CreateClusterTooManyRequests) IsServerError() bool {
	return false
}

// IsCode returns true when this create cluster too many requests response a status code equal to that given
func (o *CreateClusterTooManyRequests) IsCode(code int) bool {
	return code == 429
}

// Code gets the status code for the create cluster too many requests response
func (o *CreateClusterTooManyRequests) Code() int {
	return 429
}

func (o *CreateClusterTooManyRequests) Error() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterTooManyRequests  %+v", 429, o.Payload)
}

func (o *CreateClusterTooManyRequests) String() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterTooManyRequests  %+v", 429, o.Payload)
}

func (o *CreateClusterTooManyRequests) GetPayload() *CreateClusterTooManyRequestsBody {
	return o.Payload
}

func (o *CreateClusterTooManyRequests) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(CreateClusterTooManyRequestsBody)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewCreateClusterInternalServerError creates a CreateClusterInternalServerError with default headers values
func NewCreateClusterInternalServerError() *CreateClusterInternalServerError {
	return &CreateClusterInternalServerError{}
}

/*
CreateClusterInternalServerError describes a response with status code 500, with default header values.

Server error.
*/
type CreateClusterInternalServerError struct {
	Payload *CreateClusterInternalServerErrorBody
}

// IsSuccess returns true when this create cluster internal server error response has a 2xx status code
func (o *CreateClusterInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this create cluster internal server error response has a 3xx status code
func (o *CreateClusterInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this create cluster internal server error response has a 4xx status code
func (o *CreateClusterInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this create cluster internal server error response has a 5xx status code
func (o *CreateClusterInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this create cluster internal server error response a status code equal to that given
func (o *CreateClusterInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the create cluster internal server error response
func (o *CreateClusterInternalServerError) Code() int {
	return 500
}

func (o *CreateClusterInternalServerError) Error() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterInternalServerError  %+v", 500, o.Payload)
}

func (o *CreateClusterInternalServerError) String() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] createClusterInternalServerError  %+v", 500, o.Payload)
}

func (o *CreateClusterInternalServerError) GetPayload() *CreateClusterInternalServerErrorBody {
	return o.Payload
}

func (o *CreateClusterInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(CreateClusterInternalServerErrorBody)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewCreateClusterDefault creates a CreateClusterDefault with default headers values
func NewCreateClusterDefault(code int) *CreateClusterDefault {
	return &CreateClusterDefault{
		_statusCode: code,
	}
}

/*
CreateClusterDefault describes a response with status code -1, with default header values.

An unexpected error response.
*/
type CreateClusterDefault struct {
	_statusCode int

	Payload *CreateClusterDefaultBody
}

// IsSuccess returns true when this create cluster default response has a 2xx status code
func (o *CreateClusterDefault) IsSuccess() bool {
	return o._statusCode/100 == 2
}

// IsRedirect returns true when this create cluster default response has a 3xx status code
func (o *CreateClusterDefault) IsRedirect() bool {
	return o._statusCode/100 == 3
}

// IsClientError returns true when this create cluster default response has a 4xx status code
func (o *CreateClusterDefault) IsClientError() bool {
	return o._statusCode/100 == 4
}

// IsServerError returns true when this create cluster default response has a 5xx status code
func (o *CreateClusterDefault) IsServerError() bool {
	return o._statusCode/100 == 5
}

// IsCode returns true when this create cluster default response a status code equal to that given
func (o *CreateClusterDefault) IsCode(code int) bool {
	return o._statusCode == code
}

// Code gets the status code for the create cluster default response
func (o *CreateClusterDefault) Code() int {
	return o._statusCode
}

func (o *CreateClusterDefault) Error() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] CreateCluster default  %+v", o._statusCode, o.Payload)
}

func (o *CreateClusterDefault) String() string {
	return fmt.Sprintf("[POST /api/v1beta/projects/{project_id}/clusters][%d] CreateCluster default  %+v", o._statusCode, o.Payload)
}

func (o *CreateClusterDefault) GetPayload() *CreateClusterDefaultBody {
	return o.Payload
}

func (o *CreateClusterDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(CreateClusterDefaultBody)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

/*
CreateClusterBadRequestBody create cluster bad request body
swagger:model CreateClusterBadRequestBody
*/
type CreateClusterBadRequestBody struct {

	// code
	//
	// Error code returned with this error.
	Code int64 `json:"code,omitempty"`

	// details
	//
	// Error details returned with this error.
	Details []string `json:"details"`

	// message
	//
	// Error message returned with this error.
	Message string `json:"message,omitempty"`
}

// Validate validates this create cluster bad request body
func (o *CreateClusterBadRequestBody) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this create cluster bad request body based on context it is used
func (o *CreateClusterBadRequestBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterBadRequestBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterBadRequestBody) UnmarshalBinary(b []byte) error {
	var res CreateClusterBadRequestBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterBody CreateClusterReq
//
// CreateClusterReq is the request for creating cluster.
swagger:model CreateClusterBody
*/
type CreateClusterBody struct {

	// The cloud provider on which your TiDB cluster is hosted.
	// - `"AWS"`: the Amazon Web Services cloud provider
	// - `"GCP"`: the Google Cloud cloud provider
	// Example: AWS
	// Required: true
	// Enum: [AWS GCP]
	CloudProvider *string `json:"cloud_provider"`

	// The cluster type.
	// - `"DEVELOPER"`: create a [TiDB Serverless](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-serverless) cluster
	// - `"DEDICATED"`: create a [TiDB Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#dedicated-tier) cluster. Before creating a TiDB Dedicated cluster, you must [set a Project CIDR](https://docs.pingcap.com/tidbcloud/set-up-vpc-peering-connections#prerequisite-set-a-project-cidr) on [TiDB Cloud console](https://tidbcloud.com/).
	// Example: DEDICATED
	// Required: true
	// Enum: [DEDICATED DEVELOPER]
	ClusterType *string `json:"cluster_type"`

	// config
	// Required: true
	Config *CreateClusterParamsBodyConfig `json:"config"`

	// The name of the cluster. The name must be 4-64 characters that can only include numbers, letters, and hyphens, and the first and last character must be a letter or number.
	// Example: Cluster0
	// Required: true
	// Pattern: ^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$
	Name *string `json:"name"`

	// The region value should match the cloud provider's region code.
	// You can get the complete list of available regions from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).
	//
	// For the detailed information on each region, refer to the documentation of the corresponding cloud provider ([AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) | [GCP](https://cloud.google.com/about/locations#americas)).
	//
	// For example, if you want to deploy the cluster in the Oregon region for AWS, set the value to `"us-west-2"`.
	// Example: us-west-2
	// Required: true
	Region *string `json:"region"`
}

// Validate validates this create cluster body
func (o *CreateClusterBody) Validate(formats strfmt.Registry) error {
	var res []error

	if err := o.validateCloudProvider(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validateClusterType(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validateConfig(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validateName(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validateRegion(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

var createClusterBodyTypeCloudProviderPropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["AWS","GCP"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		createClusterBodyTypeCloudProviderPropEnum = append(createClusterBodyTypeCloudProviderPropEnum, v)
	}
}

const (

	// CreateClusterBodyCloudProviderAWS captures enum value "AWS"
	CreateClusterBodyCloudProviderAWS string = "AWS"

	// CreateClusterBodyCloudProviderGCP captures enum value "GCP"
	CreateClusterBodyCloudProviderGCP string = "GCP"
)

// prop value enum
func (o *CreateClusterBody) validateCloudProviderEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, createClusterBodyTypeCloudProviderPropEnum, true); err != nil {
		return err
	}
	return nil
}

func (o *CreateClusterBody) validateCloudProvider(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"cloud_provider", "body", o.CloudProvider); err != nil {
		return err
	}

	// value enum
	if err := o.validateCloudProviderEnum("body"+"."+"cloud_provider", "body", *o.CloudProvider); err != nil {
		return err
	}

	return nil
}

var createClusterBodyTypeClusterTypePropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["DEDICATED","DEVELOPER"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		createClusterBodyTypeClusterTypePropEnum = append(createClusterBodyTypeClusterTypePropEnum, v)
	}
}

const (

	// CreateClusterBodyClusterTypeDEDICATED captures enum value "DEDICATED"
	CreateClusterBodyClusterTypeDEDICATED string = "DEDICATED"

	// CreateClusterBodyClusterTypeDEVELOPER captures enum value "DEVELOPER"
	CreateClusterBodyClusterTypeDEVELOPER string = "DEVELOPER"
)

// prop value enum
func (o *CreateClusterBody) validateClusterTypeEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, createClusterBodyTypeClusterTypePropEnum, true); err != nil {
		return err
	}
	return nil
}

func (o *CreateClusterBody) validateClusterType(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"cluster_type", "body", o.ClusterType); err != nil {
		return err
	}

	// value enum
	if err := o.validateClusterTypeEnum("body"+"."+"cluster_type", "body", *o.ClusterType); err != nil {
		return err
	}

	return nil
}

func (o *CreateClusterBody) validateConfig(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"config", "body", o.Config); err != nil {
		return err
	}

	if o.Config != nil {
		if err := o.Config.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("body" + "." + "config")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("body" + "." + "config")
			}
			return err
		}
	}

	return nil
}

func (o *CreateClusterBody) validateName(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"name", "body", o.Name); err != nil {
		return err
	}

	if err := validate.Pattern("body"+"."+"name", "body", *o.Name, `^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$`); err != nil {
		return err
	}

	return nil
}

func (o *CreateClusterBody) validateRegion(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"region", "body", o.Region); err != nil {
		return err
	}

	return nil
}

// ContextValidate validate this create cluster body based on the context it is used
func (o *CreateClusterBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

	if err := o.contextValidateConfig(ctx, formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *CreateClusterBody) contextValidateConfig(ctx context.Context, formats strfmt.Registry) error {

	if o.Config != nil {

		if err := o.Config.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("body" + "." + "config")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("body" + "." + "config")
			}
			return err
		}
	}

	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterBody) UnmarshalBinary(b []byte) error {
	var res CreateClusterBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterDefaultBody create cluster default body
swagger:model CreateClusterDefaultBody
*/
type CreateClusterDefaultBody struct {

	// code
	Code int32 `json:"code,omitempty"`

	// details
	Details []*CreateClusterDefaultBodyDetailsItems0 `json:"details"`

	// message
	Message string `json:"message,omitempty"`
}

// Validate validates this create cluster default body
func (o *CreateClusterDefaultBody) Validate(formats strfmt.Registry) error {
	var res []error

	if err := o.validateDetails(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *CreateClusterDefaultBody) validateDetails(formats strfmt.Registry) error {
	if swag.IsZero(o.Details) { // not required
		return nil
	}

	for i := 0; i < len(o.Details); i++ {
		if swag.IsZero(o.Details[i]) { // not required
			continue
		}

		if o.Details[i] != nil {
			if err := o.Details[i].Validate(formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("CreateCluster default" + "." + "details" + "." + strconv.Itoa(i))
				} else if ce, ok := err.(*errors.CompositeError); ok {
					return ce.ValidateName("CreateCluster default" + "." + "details" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

// ContextValidate validate this create cluster default body based on the context it is used
func (o *CreateClusterDefaultBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

	if err := o.contextValidateDetails(ctx, formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *CreateClusterDefaultBody) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error {

	for i := 0; i < len(o.Details); i++ {

		if o.Details[i] != nil {

			if swag.IsZero(o.Details[i]) { // not required
				return nil
			}

			if err := o.Details[i].ContextValidate(ctx, formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("CreateCluster default" + "." + "details" + "." + strconv.Itoa(i))
				} else if ce, ok := err.(*errors.CompositeError); ok {
					return ce.ValidateName("CreateCluster default" + "." + "details" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterDefaultBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterDefaultBody) UnmarshalBinary(b []byte) error {
	var res CreateClusterDefaultBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterDefaultBodyDetailsItems0 create cluster default body details items0
swagger:model CreateClusterDefaultBodyDetailsItems0
*/
type CreateClusterDefaultBodyDetailsItems0 struct {

	// at type
	AtType string `json:"@type,omitempty"`
}

// Validate validates this create cluster default body details items0
func (o *CreateClusterDefaultBodyDetailsItems0) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this create cluster default body details items0 based on context it is used
func (o *CreateClusterDefaultBodyDetailsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterDefaultBodyDetailsItems0) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterDefaultBodyDetailsItems0) UnmarshalBinary(b []byte) error {
	var res CreateClusterDefaultBodyDetailsItems0
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterForbiddenBody create cluster forbidden body
swagger:model CreateClusterForbiddenBody
*/
type CreateClusterForbiddenBody struct {

	// code
	//
	// Error code returned with this error.
	Code int64 `json:"code,omitempty"`

	// details
	//
	// Error details returned with this error.
	Details []string `json:"details"`

	// message
	//
	// Error message returned with this error.
	Message string `json:"message,omitempty"`
}

// Validate validates this create cluster forbidden body
func (o *CreateClusterForbiddenBody) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this create cluster forbidden body based on context it is used
func (o *CreateClusterForbiddenBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterForbiddenBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterForbiddenBody) UnmarshalBinary(b []byte) error {
	var res CreateClusterForbiddenBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterInternalServerErrorBody create cluster internal server error body
swagger:model CreateClusterInternalServerErrorBody
*/
type CreateClusterInternalServerErrorBody struct {

	// code
	//
	// Error code returned with this error.
	Code int64 `json:"code,omitempty"`

	// details
	//
	// Error details returned with this error.
	Details []string `json:"details"`

	// message
	//
	// Error message returned with this error.
	Message string `json:"message,omitempty"`
}

// Validate validates this create cluster internal server error body
func (o *CreateClusterInternalServerErrorBody) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this create cluster internal server error body based on context it is used
func (o *CreateClusterInternalServerErrorBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterInternalServerErrorBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterInternalServerErrorBody) UnmarshalBinary(b []byte) error {
	var res CreateClusterInternalServerErrorBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterNotFoundBody create cluster not found body
swagger:model CreateClusterNotFoundBody
*/
type CreateClusterNotFoundBody struct {

	// code
	//
	// Error code returned with this error.
	Code int64 `json:"code,omitempty"`

	// details
	//
	// Error details returned with this error.
	Details []string `json:"details"`

	// message
	//
	// Error message returned with this error.
	Message string `json:"message,omitempty"`
}

// Validate validates this create cluster not found body
func (o *CreateClusterNotFoundBody) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this create cluster not found body based on context it is used
func (o *CreateClusterNotFoundBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterNotFoundBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterNotFoundBody) UnmarshalBinary(b []byte) error {
	var res CreateClusterNotFoundBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterOKBody CreateClusterResp
//
// CreateClusterResp is the response for creating cluster.
swagger:model CreateClusterOKBody
*/
type CreateClusterOKBody struct {

	// The ID of the cluster.
	// Example: 1
	// Required: true
	ID *string `json:"id"`
}

// Validate validates this create cluster o k body
func (o *CreateClusterOKBody) Validate(formats strfmt.Registry) error {
	var res []error

	if err := o.validateID(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *CreateClusterOKBody) validateID(formats strfmt.Registry) error {

	if err := validate.Required("createClusterOK"+"."+"id", "body", o.ID); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this create cluster o k body based on context it is used
func (o *CreateClusterOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterOKBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterOKBody) UnmarshalBinary(b []byte) error {
	var res CreateClusterOKBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterParamsBodyConfig The configuration of the cluster.
swagger:model CreateClusterParamsBodyConfig
*/
type CreateClusterParamsBodyConfig struct {

	// components
	Components *CreateClusterParamsBodyConfigComponents `json:"components,omitempty"`

	// A list of IP addresses and Classless Inter-Domain Routing (CIDR) addresses that are allowed to access the TiDB Cloud cluster via [standard connection](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster#connect-via-standard-connection).
	IPAccessList []*CreateClusterParamsBodyConfigIPAccessListItems0 `json:"ip_access_list"`

	// The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.
	//
	// **Limitations**:
	// - For a TiDB Serverless cluster, only port `4000` is available.
	// Example: 4000
	// Maximum: 65535
	// Minimum: 1024
	Port int32 `json:"port,omitempty"`

	// The root password to access the cluster. It must be 8-64 characters.
	// Example: password_example
	// Required: true
	// Max Length: 64
	// Min Length: 8
	RootPassword *string `json:"root_password"`
}

// Validate validates this create cluster params body config
func (o *CreateClusterParamsBodyConfig) Validate(formats strfmt.Registry) error {
	var res []error

	if err := o.validateComponents(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validateIPAccessList(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validatePort(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validateRootPassword(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *CreateClusterParamsBodyConfig) validateComponents(formats strfmt.Registry) error {
	if swag.IsZero(o.Components) { // not required
		return nil
	}

	if o.Components != nil {
		if err := o.Components.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("body" + "." + "config" + "." + "components")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("body" + "." + "config" + "." + "components")
			}
			return err
		}
	}

	return nil
}

func (o *CreateClusterParamsBodyConfig) validateIPAccessList(formats strfmt.Registry) error {
	if swag.IsZero(o.IPAccessList) { // not required
		return nil
	}

	for i := 0; i < len(o.IPAccessList); i++ {
		if swag.IsZero(o.IPAccessList[i]) { // not required
			continue
		}

		if o.IPAccessList[i] != nil {
			if err := o.IPAccessList[i].Validate(formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("body" + "." + "config" + "." + "ip_access_list" + "." + strconv.Itoa(i))
				} else if ce, ok := err.(*errors.CompositeError); ok {
					return ce.ValidateName("body" + "." + "config" + "." + "ip_access_list" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

func (o *CreateClusterParamsBodyConfig) validatePort(formats strfmt.Registry) error {
	if swag.IsZero(o.Port) { // not required
		return nil
	}

	if err := validate.MinimumInt("body"+"."+"config"+"."+"port", "body", int64(o.Port), 1024, false); err != nil {
		return err
	}

	if err := validate.MaximumInt("body"+"."+"config"+"."+"port", "body", int64(o.Port), 65535, false); err != nil {
		return err
	}

	return nil
}

func (o *CreateClusterParamsBodyConfig) validateRootPassword(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"config"+"."+"root_password", "body", o.RootPassword); err != nil {
		return err
	}

	if err := validate.MinLength("body"+"."+"config"+"."+"root_password", "body", *o.RootPassword, 8); err != nil {
		return err
	}

	if err := validate.MaxLength("body"+"."+"config"+"."+"root_password", "body", *o.RootPassword, 64); err != nil {
		return err
	}

	return nil
}

// ContextValidate validate this create cluster params body config based on the context it is used
func (o *CreateClusterParamsBodyConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

	if err := o.contextValidateComponents(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := o.contextValidateIPAccessList(ctx, formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *CreateClusterParamsBodyConfig) contextValidateComponents(ctx context.Context, formats strfmt.Registry) error {

	if o.Components != nil {

		if swag.IsZero(o.Components) { // not required
			return nil
		}

		if err := o.Components.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("body" + "." + "config" + "." + "components")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("body" + "." + "config" + "." + "components")
			}
			return err
		}
	}

	return nil
}

func (o *CreateClusterParamsBodyConfig) contextValidateIPAccessList(ctx context.Context, formats strfmt.Registry) error {

	for i := 0; i < len(o.IPAccessList); i++ {

		if o.IPAccessList[i] != nil {

			if swag.IsZero(o.IPAccessList[i]) { // not required
				return nil
			}

			if err := o.IPAccessList[i].ContextValidate(ctx, formats); err != nil {
				if ve, ok := err.(*errors.Validation); ok {
					return ve.ValidateName("body" + "." + "config" + "." + "ip_access_list" + "." + strconv.Itoa(i))
				} else if ce, ok := err.(*errors.CompositeError); ok {
					return ce.ValidateName("body" + "." + "config" + "." + "ip_access_list" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterParamsBodyConfig) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterParamsBodyConfig) UnmarshalBinary(b []byte) error {
	var res CreateClusterParamsBodyConfig
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterParamsBodyConfigComponents The components of the cluster.
//
// **Limitations**:
// - For a TiDB Dedicated cluster, the `components` parameter is **required**.
// - For a TiDB Serverless cluster, the `components` value is **ignored**. Setting this configuration does not have any effects.
// Example: {"tidb":{"node_quantity":2,"node_size":"8C16G"},"tikv":{"node_quantity":3,"node_size":"8C32G","storage_size_gib":1024}}
swagger:model CreateClusterParamsBodyConfigComponents
*/
type CreateClusterParamsBodyConfigComponents struct {

	// tidb
	// Required: true
	Tidb *CreateClusterParamsBodyConfigComponentsTidb `json:"tidb"`

	// tiflash
	Tiflash *CreateClusterParamsBodyConfigComponentsTiflash `json:"tiflash,omitempty"`

	// tikv
	// Required: true
	Tikv *CreateClusterParamsBodyConfigComponentsTikv `json:"tikv"`
}

// Validate validates this create cluster params body config components
func (o *CreateClusterParamsBodyConfigComponents) Validate(formats strfmt.Registry) error {
	var res []error

	if err := o.validateTidb(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validateTiflash(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validateTikv(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *CreateClusterParamsBodyConfigComponents) validateTidb(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"config"+"."+"components"+"."+"tidb", "body", o.Tidb); err != nil {
		return err
	}

	if o.Tidb != nil {
		if err := o.Tidb.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("body" + "." + "config" + "." + "components" + "." + "tidb")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("body" + "." + "config" + "." + "components" + "." + "tidb")
			}
			return err
		}
	}

	return nil
}

func (o *CreateClusterParamsBodyConfigComponents) validateTiflash(formats strfmt.Registry) error {
	if swag.IsZero(o.Tiflash) { // not required
		return nil
	}

	if o.Tiflash != nil {
		if err := o.Tiflash.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("body" + "." + "config" + "." + "components" + "." + "tiflash")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("body" + "." + "config" + "." + "components" + "." + "tiflash")
			}
			return err
		}
	}

	return nil
}

func (o *CreateClusterParamsBodyConfigComponents) validateTikv(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"config"+"."+"components"+"."+"tikv", "body", o.Tikv); err != nil {
		return err
	}

	if o.Tikv != nil {
		if err := o.Tikv.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("body" + "." + "config" + "." + "components" + "." + "tikv")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("body" + "." + "config" + "." + "components" + "." + "tikv")
			}
			return err
		}
	}

	return nil
}

// ContextValidate validate this create cluster params body config components based on the context it is used
func (o *CreateClusterParamsBodyConfigComponents) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

	if err := o.contextValidateTidb(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := o.contextValidateTiflash(ctx, formats); err != nil {
		res = append(res, err)
	}

	if err := o.contextValidateTikv(ctx, formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *CreateClusterParamsBodyConfigComponents) contextValidateTidb(ctx context.Context, formats strfmt.Registry) error {

	if o.Tidb != nil {

		if err := o.Tidb.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("body" + "." + "config" + "." + "components" + "." + "tidb")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("body" + "." + "config" + "." + "components" + "." + "tidb")
			}
			return err
		}
	}

	return nil
}

func (o *CreateClusterParamsBodyConfigComponents) contextValidateTiflash(ctx context.Context, formats strfmt.Registry) error {

	if o.Tiflash != nil {

		if swag.IsZero(o.Tiflash) { // not required
			return nil
		}

		if err := o.Tiflash.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("body" + "." + "config" + "." + "components" + "." + "tiflash")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("body" + "." + "config" + "." + "components" + "." + "tiflash")
			}
			return err
		}
	}

	return nil
}

func (o *CreateClusterParamsBodyConfigComponents) contextValidateTikv(ctx context.Context, formats strfmt.Registry) error {

	if o.Tikv != nil {

		if err := o.Tikv.ContextValidate(ctx, formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("body" + "." + "config" + "." + "components" + "." + "tikv")
			} else if ce, ok := err.(*errors.CompositeError); ok {
				return ce.ValidateName("body" + "." + "config" + "." + "components" + "." + "tikv")
			}
			return err
		}
	}

	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterParamsBodyConfigComponents) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterParamsBodyConfigComponents) UnmarshalBinary(b []byte) error {
	var res CreateClusterParamsBodyConfigComponents
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterParamsBodyConfigComponentsTidb The TiDB component of the cluster.
swagger:model CreateClusterParamsBodyConfigComponentsTidb
*/
type CreateClusterParamsBodyConfigComponentsTidb struct {

	// The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).
	//
	// Example: 2
	// Required: true
	NodeQuantity *int32 `json:"node_quantity"`

	// The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).
	//
	// **Additional combination rules**:
	// - If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.
	// - If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.
	// Example: 8C16G
	// Required: true
	NodeSize *string `json:"node_size"`
}

// Validate validates this create cluster params body config components tidb
func (o *CreateClusterParamsBodyConfigComponentsTidb) Validate(formats strfmt.Registry) error {
	var res []error

	if err := o.validateNodeQuantity(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validateNodeSize(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *CreateClusterParamsBodyConfigComponentsTidb) validateNodeQuantity(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"config"+"."+"components"+"."+"tidb"+"."+"node_quantity", "body", o.NodeQuantity); err != nil {
		return err
	}

	return nil
}

func (o *CreateClusterParamsBodyConfigComponentsTidb) validateNodeSize(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"config"+"."+"components"+"."+"tidb"+"."+"node_size", "body", o.NodeSize); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this create cluster params body config components tidb based on context it is used
func (o *CreateClusterParamsBodyConfigComponentsTidb) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterParamsBodyConfigComponentsTidb) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterParamsBodyConfigComponentsTidb) UnmarshalBinary(b []byte) error {
	var res CreateClusterParamsBodyConfigComponentsTidb
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterParamsBodyConfigComponentsTiflash The TiFlash component of the cluster.
swagger:model CreateClusterParamsBodyConfigComponentsTiflash
*/
type CreateClusterParamsBodyConfigComponentsTiflash struct {

	// The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).
	// Example: 1
	// Required: true
	NodeQuantity *int32 `json:"node_quantity"`

	// The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).
	//
	// **Additional combination rules**:
	// - If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.
	// - If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.
	// Example: 8C64G
	// Required: true
	NodeSize *string `json:"node_size"`

	// The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).
	//
	// Example: 1024
	// Required: true
	StorageSizeGib *int32 `json:"storage_size_gib"`
}

// Validate validates this create cluster params body config components tiflash
func (o *CreateClusterParamsBodyConfigComponentsTiflash) Validate(formats strfmt.Registry) error {
	var res []error

	if err := o.validateNodeQuantity(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validateNodeSize(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validateStorageSizeGib(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *CreateClusterParamsBodyConfigComponentsTiflash) validateNodeQuantity(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"config"+"."+"components"+"."+"tiflash"+"."+"node_quantity", "body", o.NodeQuantity); err != nil {
		return err
	}

	return nil
}

func (o *CreateClusterParamsBodyConfigComponentsTiflash) validateNodeSize(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"config"+"."+"components"+"."+"tiflash"+"."+"node_size", "body", o.NodeSize); err != nil {
		return err
	}

	return nil
}

func (o *CreateClusterParamsBodyConfigComponentsTiflash) validateStorageSizeGib(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"config"+"."+"components"+"."+"tiflash"+"."+"storage_size_gib", "body", o.StorageSizeGib); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this create cluster params body config components tiflash based on context it is used
func (o *CreateClusterParamsBodyConfigComponentsTiflash) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterParamsBodyConfigComponentsTiflash) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterParamsBodyConfigComponentsTiflash) UnmarshalBinary(b []byte) error {
	var res CreateClusterParamsBodyConfigComponentsTiflash
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterParamsBodyConfigComponentsTikv The TiKV component of the cluster.
swagger:model CreateClusterParamsBodyConfigComponentsTikv
*/
type CreateClusterParamsBodyConfigComponentsTikv struct {

	// The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).
	//
	// **Limitations**:
	// - The `node_quantity` of TiKV must be a multiple of 3.
	// Example: 3
	// Required: true
	NodeQuantity *int32 `json:"node_quantity"`

	// The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).
	//
	// **Additional combination rules**:
	// - If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.
	// - If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.
	// Example: 8C64G
	// Required: true
	NodeSize *string `json:"node_size"`

	// The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).
	// Example: 1024
	// Required: true
	StorageSizeGib *int32 `json:"storage_size_gib"`
}

// Validate validates this create cluster params body config components tikv
func (o *CreateClusterParamsBodyConfigComponentsTikv) Validate(formats strfmt.Registry) error {
	var res []error

	if err := o.validateNodeQuantity(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validateNodeSize(formats); err != nil {
		res = append(res, err)
	}

	if err := o.validateStorageSizeGib(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *CreateClusterParamsBodyConfigComponentsTikv) validateNodeQuantity(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"config"+"."+"components"+"."+"tikv"+"."+"node_quantity", "body", o.NodeQuantity); err != nil {
		return err
	}

	return nil
}

func (o *CreateClusterParamsBodyConfigComponentsTikv) validateNodeSize(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"config"+"."+"components"+"."+"tikv"+"."+"node_size", "body", o.NodeSize); err != nil {
		return err
	}

	return nil
}

func (o *CreateClusterParamsBodyConfigComponentsTikv) validateStorageSizeGib(formats strfmt.Registry) error {

	if err := validate.Required("body"+"."+"config"+"."+"components"+"."+"tikv"+"."+"storage_size_gib", "body", o.StorageSizeGib); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this create cluster params body config components tikv based on context it is used
func (o *CreateClusterParamsBodyConfigComponentsTikv) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterParamsBodyConfigComponentsTikv) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterParamsBodyConfigComponentsTikv) UnmarshalBinary(b []byte) error {
	var res CreateClusterParamsBodyConfigComponentsTikv
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterParamsBodyConfigIPAccessListItems0 create cluster params body config IP access list items0
swagger:model CreateClusterParamsBodyConfigIPAccessListItems0
*/
type CreateClusterParamsBodyConfigIPAccessListItems0 struct {

	// The IP address or CIDR range that you want to add to the cluster's IP access list.
	// Example: 8.8.8.8/32
	// Required: true
	Cidr *string `json:"cidr"`

	// Description that explains the purpose of the entry.
	// Example: My Current IP Address
	Description string `json:"description,omitempty"`
}

// Validate validates this create cluster params body config IP access list items0
func (o *CreateClusterParamsBodyConfigIPAccessListItems0) Validate(formats strfmt.Registry) error {
	var res []error

	if err := o.validateCidr(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

func (o *CreateClusterParamsBodyConfigIPAccessListItems0) validateCidr(formats strfmt.Registry) error {

	if err := validate.Required("cidr", "body", o.Cidr); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this create cluster params body config IP access list items0 based on context it is used
func (o *CreateClusterParamsBodyConfigIPAccessListItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterParamsBodyConfigIPAccessListItems0) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterParamsBodyConfigIPAccessListItems0) UnmarshalBinary(b []byte) error {
	var res CreateClusterParamsBodyConfigIPAccessListItems0
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}

/*
CreateClusterTooManyRequestsBody create cluster too many requests body
swagger:model CreateClusterTooManyRequestsBody
*/
type CreateClusterTooManyRequestsBody struct {

	// code
	//
	// Error code returned with this error.
	Code int64 `json:"code,omitempty"`

	// details
	//
	// Error details returned with this error.
	Details []string `json:"details"`

	// message
	//
	// Error message returned with this error.
	Message string `json:"message,omitempty"`
}

// Validate validates this create cluster too many requests body
func (o *CreateClusterTooManyRequestsBody) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this create cluster too many requests body based on context it is used
func (o *CreateClusterTooManyRequestsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (o *CreateClusterTooManyRequestsBody) MarshalBinary() ([]byte, error) {
	if o == nil {
		return nil, nil
	}
	return swag.WriteJSON(o)
}

// UnmarshalBinary interface implementation
func (o *CreateClusterTooManyRequestsBody) UnmarshalBinary(b []byte) error {
	var res CreateClusterTooManyRequestsBody
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*o = res
	return nil
}
