/*
 * Pipeline API
 *
 * Pipeline is a feature rich application platform, built for containers on top of Kubernetes to automate the DevOps experience, continuous application development and the lifecycle of deployments. 
 *
 * API version: latest
 * Contact: info@banzaicloud.com
 * Generated by: OpenAPI Generator (https://openapi-generator.tech)
 */

package pipeline

type CreateEksPropertiesEks struct {

	AuthConfig EksAuthConfig `json:"authConfig,omitempty"`

	Version string `json:"version,omitempty"`

	// List of encryption config objects to define the encryption providers and their corresponding resources to encrypt. More information can be found at https://docs.aws.amazon.com/eks/latest/userguide/create-cluster.html and https://docs.aws.amazon.com/eks/latest/APIReference/API_CreateCluster.html.
	EncryptionConfig []EksEncryptionConfig `json:"encryptionConfig,omitempty"`

	LogTypes []string `json:"logTypes,omitempty"`

	NodePools map[string]EksNodePool `json:"nodePools"`

	Vpc EksVpc `json:"vpc,omitempty"`

	// Id of the RouteTable of the VPC to be used by subnets. This is used only when subnets are created into existing VPC.
	RouteTableId string `json:"routeTableId,omitempty"`

	// Subnets for EKS master and worker nodes. All worker nodes will be launched in the same subnet (the first subnet in the list - which may not coincide with first subnet in the cluster create request payload as the deserialization may change the order) unless a subnet is specified for the workers that belong to a node pool at node pool level.
	Subnets []EksSubnet `json:"subnets,omitempty"`

	Iam EksIam `json:"iam,omitempty"`

	// List of access point types for the API server; public and private are the only valid values
	ApiServerAccessPoints []string `json:"apiServerAccessPoints,omitempty"`

	// User defined tags to be added to created AWS resources. Empty keys and values are not permitted.
	Tags map[string]string `json:"tags,omitempty"`
}

// AssertCreateEksPropertiesEksRequired checks if the required fields are not zero-ed
func AssertCreateEksPropertiesEksRequired(obj CreateEksPropertiesEks) error {
	elements := map[string]interface{}{
		"nodePools": obj.NodePools,
	}
	for name, el := range elements {
		if isZero := IsZeroValue(el); isZero {
			return &RequiredError{Field: name}
		}
	}

	if err := AssertEksAuthConfigRequired(obj.AuthConfig); err != nil {
		return err
	}
	for _, el := range obj.EncryptionConfig {
		if err := AssertEksEncryptionConfigRequired(el); err != nil {
			return err
		}
	}
	if err := AssertEksVpcRequired(obj.Vpc); err != nil {
		return err
	}
	for _, el := range obj.Subnets {
		if err := AssertEksSubnetRequired(el); err != nil {
			return err
		}
	}
	if err := AssertEksIamRequired(obj.Iam); err != nil {
		return err
	}
	return nil
}

// AssertRecurseCreateEksPropertiesEksRequired recursively checks if required fields are not zero-ed in a nested slice.
// Accepts only nested slice of CreateEksPropertiesEks (e.g. [][]CreateEksPropertiesEks), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseCreateEksPropertiesEksRequired(objSlice interface{}) error {
	return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
		aCreateEksPropertiesEks, ok := obj.(CreateEksPropertiesEks)
		if !ok {
			return ErrTypeAssertionError
		}
		return AssertCreateEksPropertiesEksRequired(aCreateEksPropertiesEks)
	})
}
