// 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"
	"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"
)

// CreateAccesspointReader is a Reader for the CreateAccesspoint structure.
type CreateAccesspointReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *CreateAccesspointReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewCreateAccesspointOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewCreateAccesspointBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewCreateAccesspointUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewCreateAccesspointForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewCreateAccesspointNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 429:
		result := NewCreateAccesspointTooManyRequests()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewCreateAccesspointInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		result := NewCreateAccesspointDefault(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
	}
}

// NewCreateAccesspointOK creates a CreateAccesspointOK with default headers values
func NewCreateAccesspointOK() *CreateAccesspointOK {
	return &CreateAccesspointOK{}
}

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

A successful response.
*/
type CreateAccesspointOK struct {
	Payload *CreateAccesspointOKBody
}

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

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

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

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

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

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

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

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

func (o *CreateAccesspointOK) GetPayload() *CreateAccesspointOKBody {
	return o.Payload
}

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

	o.Payload = new(CreateAccesspointOKBody)

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

	return nil
}

// NewCreateAccesspointBadRequest creates a CreateAccesspointBadRequest with default headers values
func NewCreateAccesspointBadRequest() *CreateAccesspointBadRequest {
	return &CreateAccesspointBadRequest{}
}

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

A request field is invalid.
*/
type CreateAccesspointBadRequest struct {
	Payload *CreateAccesspointBadRequestBody
}

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

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

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

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

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

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

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

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

func (o *CreateAccesspointBadRequest) GetPayload() *CreateAccesspointBadRequestBody {
	return o.Payload
}

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

	o.Payload = new(CreateAccesspointBadRequestBody)

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

	return nil
}

// NewCreateAccesspointUnauthorized creates a CreateAccesspointUnauthorized with default headers values
func NewCreateAccesspointUnauthorized() *CreateAccesspointUnauthorized {
	return &CreateAccesspointUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

func (o *CreateAccesspointUnauthorized) 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
}

// NewCreateAccesspointForbidden creates a CreateAccesspointForbidden with default headers values
func NewCreateAccesspointForbidden() *CreateAccesspointForbidden {
	return &CreateAccesspointForbidden{}
}

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

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

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

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

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

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

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

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

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

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

func (o *CreateAccesspointForbidden) GetPayload() *CreateAccesspointForbiddenBody {
	return o.Payload
}

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

	o.Payload = new(CreateAccesspointForbiddenBody)

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

	return nil
}

// NewCreateAccesspointNotFound creates a CreateAccesspointNotFound with default headers values
func NewCreateAccesspointNotFound() *CreateAccesspointNotFound {
	return &CreateAccesspointNotFound{}
}

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

The requested resource does not exist.
*/
type CreateAccesspointNotFound struct {
	Payload *CreateAccesspointNotFoundBody
}

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

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

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

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

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

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

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

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

func (o *CreateAccesspointNotFound) GetPayload() *CreateAccesspointNotFoundBody {
	return o.Payload
}

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

	o.Payload = new(CreateAccesspointNotFoundBody)

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

	return nil
}

// NewCreateAccesspointTooManyRequests creates a CreateAccesspointTooManyRequests with default headers values
func NewCreateAccesspointTooManyRequests() *CreateAccesspointTooManyRequests {
	return &CreateAccesspointTooManyRequests{}
}

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

You have exceed the rate limit.
*/
type CreateAccesspointTooManyRequests struct {
	Payload *CreateAccesspointTooManyRequestsBody
}

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

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

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

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

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

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

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

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

func (o *CreateAccesspointTooManyRequests) GetPayload() *CreateAccesspointTooManyRequestsBody {
	return o.Payload
}

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

	o.Payload = new(CreateAccesspointTooManyRequestsBody)

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

	return nil
}

// NewCreateAccesspointInternalServerError creates a CreateAccesspointInternalServerError with default headers values
func NewCreateAccesspointInternalServerError() *CreateAccesspointInternalServerError {
	return &CreateAccesspointInternalServerError{}
}

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

Server error.
*/
type CreateAccesspointInternalServerError struct {
	Payload *CreateAccesspointInternalServerErrorBody
}

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

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

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

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

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

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

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

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

func (o *CreateAccesspointInternalServerError) GetPayload() *CreateAccesspointInternalServerErrorBody {
	return o.Payload
}

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

	o.Payload = new(CreateAccesspointInternalServerErrorBody)

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

	return nil
}

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

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

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

	Payload *CreateAccesspointDefaultBody
}

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

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

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

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

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

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

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

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

func (o *CreateAccesspointDefault) GetPayload() *CreateAccesspointDefaultBody {
	return o.Payload
}

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

	o.Payload = new(CreateAccesspointDefaultBody)

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

	return nil
}

/*
CreateAccesspointBadRequestBody create accesspoint bad request body
swagger:model CreateAccesspointBadRequestBody
*/
type CreateAccesspointBadRequestBody 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 accesspoint bad request body
func (o *CreateAccesspointBadRequestBody) Validate(formats strfmt.Registry) error {
	return nil
}

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

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

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

/*
CreateAccesspointBody CreateAccesspointReq
//
// CreateAccesspointReq is the request for creating an accesspoint for a cluster.
swagger:model CreateAccesspointBody
*/
type CreateAccesspointBody struct {

	// The display name of the accesspoint. 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: Accesspoint
	// Required: true
	// Pattern: ^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$
	DisplayName *string `json:"display_name"`

	// public endpoint
	PublicEndpoint *CreateAccesspointParamsBodyPublicEndpoint `json:"public_endpoint,omitempty"`
}

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

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

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

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

func (o *CreateAccesspointBody) validateDisplayName(formats strfmt.Registry) error {

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

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

	return nil
}

func (o *CreateAccesspointBody) validatePublicEndpoint(formats strfmt.Registry) error {
	if swag.IsZero(o.PublicEndpoint) { // not required
		return nil
	}

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

	return nil
}

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

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

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

func (o *CreateAccesspointBody) contextValidatePublicEndpoint(ctx context.Context, formats strfmt.Registry) error {

	if o.PublicEndpoint != nil {

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

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

	return nil
}

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

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

/*
CreateAccesspointDefaultBody create accesspoint default body
swagger:model CreateAccesspointDefaultBody
*/
type CreateAccesspointDefaultBody struct {

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

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

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

// Validate validates this create accesspoint default body
func (o *CreateAccesspointDefaultBody) 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 *CreateAccesspointDefaultBody) 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("CreateAccesspoint default" + "." + "details" + "." + strconv.Itoa(i))
				} else if ce, ok := err.(*errors.CompositeError); ok {
					return ce.ValidateName("CreateAccesspoint default" + "." + "details" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

// ContextValidate validate this create accesspoint default body based on the context it is used
func (o *CreateAccesspointDefaultBody) 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 *CreateAccesspointDefaultBody) 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("CreateAccesspoint default" + "." + "details" + "." + strconv.Itoa(i))
				} else if ce, ok := err.(*errors.CompositeError); ok {
					return ce.ValidateName("CreateAccesspoint default" + "." + "details" + "." + strconv.Itoa(i))
				}
				return err
			}
		}

	}

	return nil
}

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

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

/*
CreateAccesspointDefaultBodyDetailsItems0 create accesspoint default body details items0
swagger:model CreateAccesspointDefaultBodyDetailsItems0
*/
type CreateAccesspointDefaultBodyDetailsItems0 struct {

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

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

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

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

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

/*
CreateAccesspointForbiddenBody create accesspoint forbidden body
swagger:model CreateAccesspointForbiddenBody
*/
type CreateAccesspointForbiddenBody 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 accesspoint forbidden body
func (o *CreateAccesspointForbiddenBody) Validate(formats strfmt.Registry) error {
	return nil
}

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

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

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

/*
CreateAccesspointInternalServerErrorBody create accesspoint internal server error body
swagger:model CreateAccesspointInternalServerErrorBody
*/
type CreateAccesspointInternalServerErrorBody 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 accesspoint internal server error body
func (o *CreateAccesspointInternalServerErrorBody) Validate(formats strfmt.Registry) error {
	return nil
}

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

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

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

/*
CreateAccesspointNotFoundBody create accesspoint not found body
swagger:model CreateAccesspointNotFoundBody
*/
type CreateAccesspointNotFoundBody 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 accesspoint not found body
func (o *CreateAccesspointNotFoundBody) Validate(formats strfmt.Registry) error {
	return nil
}

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

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

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

/*
CreateAccesspointOKBody create accesspoint o k body
swagger:model CreateAccesspointOKBody
*/
type CreateAccesspointOKBody struct {

	// The ID of the accesspoint.
	// Example: 1
	ID string `json:"id,omitempty"`
}

// Validate validates this create accesspoint o k body
func (o *CreateAccesspointOKBody) Validate(formats strfmt.Registry) error {
	return nil
}

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

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

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

/*
CreateAccesspointParamsBodyPublicEndpoint The public endpoint.
swagger:model CreateAccesspointParamsBodyPublicEndpoint
*/
type CreateAccesspointParamsBodyPublicEndpoint struct {

	// The IP allowlist for the public endpoint.
	IPAllowlist []*CreateAccesspointParamsBodyPublicEndpointIPAllowlistItems0 `json:"ip_allowlist"`
}

// Validate validates this create accesspoint params body public endpoint
func (o *CreateAccesspointParamsBodyPublicEndpoint) Validate(formats strfmt.Registry) error {
	var res []error

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

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

func (o *CreateAccesspointParamsBodyPublicEndpoint) validateIPAllowlist(formats strfmt.Registry) error {
	if swag.IsZero(o.IPAllowlist) { // not required
		return nil
	}

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

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

	}

	return nil
}

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

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

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

func (o *CreateAccesspointParamsBodyPublicEndpoint) contextValidateIPAllowlist(ctx context.Context, formats strfmt.Registry) error {

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

		if o.IPAllowlist[i] != nil {

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

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

	}

	return nil
}

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

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

/*
CreateAccesspointParamsBodyPublicEndpointIPAllowlistItems0 create accesspoint params body public endpoint IP allowlist items0
swagger:model CreateAccesspointParamsBodyPublicEndpointIPAllowlistItems0
*/
type CreateAccesspointParamsBodyPublicEndpointIPAllowlistItems0 struct {

	// CIDR.
	// Example: 0.0.0.0/0
	Cidr string `json:"cidr,omitempty"`
}

// Validate validates this create accesspoint params body public endpoint IP allowlist items0
func (o *CreateAccesspointParamsBodyPublicEndpointIPAllowlistItems0) Validate(formats strfmt.Registry) error {
	return nil
}

// ContextValidate validates this create accesspoint params body public endpoint IP allowlist items0 based on context it is used
func (o *CreateAccesspointParamsBodyPublicEndpointIPAllowlistItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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

/*
CreateAccesspointTooManyRequestsBody create accesspoint too many requests body
swagger:model CreateAccesspointTooManyRequestsBody
*/
type CreateAccesspointTooManyRequestsBody 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 accesspoint too many requests body
func (o *CreateAccesspointTooManyRequestsBody) Validate(formats strfmt.Registry) error {
	return nil
}

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

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

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