/*
 * 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 EksNodePool struct {

	InstanceType string `json:"instanceType"`

	SpotPrice string `json:"spotPrice"`

	Autoscaling bool `json:"autoscaling,omitempty"`

	Count int32 `json:"count,omitempty"`

	MinCount int32 `json:"minCount"`

	MaxCount int32 `json:"maxCount"`

	Labels map[string]string `json:"labels,omitempty"`

	VolumeEncryption *EksNodePoolVolumeEncryption `json:"volumeEncryption,omitempty"`

	// Size of the EBS volume in GiBs of the nodes in the pool.
	VolumeSize int32 `json:"volumeSize,omitempty"`

	Image string `json:"image,omitempty"`

	Subnet EksSubnet `json:"subnet,omitempty"`

	// List of additional custom security groups for all nodes in the pool.
	SecurityGroups []string `json:"securityGroups,omitempty"`

	// Setup available instance stores (NVMe disks) to use for Kubelet root if available. As a result emptyDir volumes will be provisioned on local instance storage disks. You can check out available instance storages here https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#instance-store-volumes.
	UseInstanceStore bool `json:"useInstanceStore,omitempty"`
}

// AssertEksNodePoolRequired checks if the required fields are not zero-ed
func AssertEksNodePoolRequired(obj EksNodePool) error {
	elements := map[string]interface{}{
		"instanceType": obj.InstanceType,
		"spotPrice": obj.SpotPrice,
		"minCount": obj.MinCount,
		"maxCount": obj.MaxCount,
	}
	for name, el := range elements {
		if isZero := IsZeroValue(el); isZero {
			return &RequiredError{Field: name}
		}
	}

	if obj.VolumeEncryption != nil {
		if err := AssertEksNodePoolVolumeEncryptionRequired(*obj.VolumeEncryption); err != nil {
			return err
		}
	}
	if err := AssertEksSubnetRequired(obj.Subnet); err != nil {
		return err
	}
	return nil
}

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