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

package model

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

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

// OpenapiPrivateEndpoint openapi private endpoint
//
// swagger:model openapiPrivateEndpoint
type OpenapiPrivateEndpoint struct {

	// [Output Only] The cloud provider on which the private endpoint service is hosted.
	// - `"AWS"`: the Amazon Web Services cloud provider
	// - `"GCP"`: the Google Cloud cloud provider
	// Example: AWS
	// Enum: [AWS GCP]
	CloudProvider string `json:"cloud_provider,omitempty"`

	// [Output Only] The ID of the cluster.
	// Example: 1
	ClusterID string `json:"cluster_id,omitempty"`

	// [Output Only] The name of the cluster.
	// Example: Cluster0
	ClusterName string `json:"cluster_name,omitempty"`

	// The format of the private endpoint name varies by cloud provider: `"vpce-xxxx"` for AWS and `"projects/xxx/regions/xxx/forwardingRules/xxx"` for Google Cloud.
	// Example: vpce-01234567890123456
	EndpointName string `json:"endpoint_name,omitempty"`

	// [Output Only] The ID of private endpoint. It is used when you [deleting the endpoint](#tag/Cluster/operation/DeletePrivateEndpoint).
	// Example: 1
	ID string `json:"id,omitempty"`

	// [Output Only] The detailed message when the `status` is "FAILED".
	// Example: The endpoint does not exist.
	Message string `json:"message,omitempty"`

	// [Output Only] The region where the private endpoint is hosted, such as Oregon in AWS.
	// Example: Oregon
	RegionName string `json:"region_name,omitempty"`

	// [Output Only] The service name of the private endpoint.
	// Example: com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456
	ServiceName string `json:"service_name,omitempty"`

	// [Output Only] The status of the private endpoint service.
	// Example: ACTIVE
	// Enum: [CREATING ACTIVE DELETING]
	ServiceStatus string `json:"service_status,omitempty"`

	// [Output Only] The status of the private endpoint.
	// Example: FAILED
	// Enum: [PENDING ACTIVE DELETING FAILED]
	Status string `json:"status,omitempty"`
}

// Validate validates this openapi private endpoint
func (m *OpenapiPrivateEndpoint) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

var openapiPrivateEndpointTypeCloudProviderPropEnum []interface{}

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

const (

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

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

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

func (m *OpenapiPrivateEndpoint) validateCloudProvider(formats strfmt.Registry) error {
	if swag.IsZero(m.CloudProvider) { // not required
		return nil
	}

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

	return nil
}

var openapiPrivateEndpointTypeServiceStatusPropEnum []interface{}

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

const (

	// OpenapiPrivateEndpointServiceStatusCREATING captures enum value "CREATING"
	OpenapiPrivateEndpointServiceStatusCREATING string = "CREATING"

	// OpenapiPrivateEndpointServiceStatusACTIVE captures enum value "ACTIVE"
	OpenapiPrivateEndpointServiceStatusACTIVE string = "ACTIVE"

	// OpenapiPrivateEndpointServiceStatusDELETING captures enum value "DELETING"
	OpenapiPrivateEndpointServiceStatusDELETING string = "DELETING"
)

// prop value enum
func (m *OpenapiPrivateEndpoint) validateServiceStatusEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, openapiPrivateEndpointTypeServiceStatusPropEnum, true); err != nil {
		return err
	}
	return nil
}

func (m *OpenapiPrivateEndpoint) validateServiceStatus(formats strfmt.Registry) error {
	if swag.IsZero(m.ServiceStatus) { // not required
		return nil
	}

	// value enum
	if err := m.validateServiceStatusEnum("service_status", "body", m.ServiceStatus); err != nil {
		return err
	}

	return nil
}

var openapiPrivateEndpointTypeStatusPropEnum []interface{}

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

// prop value enum
func (m *OpenapiPrivateEndpoint) validateStatusEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, openapiPrivateEndpointTypeStatusPropEnum, true); err != nil {
		return err
	}
	return nil
}

func (m *OpenapiPrivateEndpoint) validateStatus(formats strfmt.Registry) error {
	if swag.IsZero(m.Status) { // not required
		return nil
	}

	// value enum
	if err := m.validateStatusEnum("status", "body", m.Status); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this openapi private endpoint based on context it is used
func (m *OpenapiPrivateEndpoint) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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