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

	Name string `json:"name"`

	Roles []string `json:"roles"`

	// user provided custom node labels to be placed onto the nodes of the node pool
	Labels map[string]string `json:"labels,omitempty"`

	// Enables/disables autoscaling of this node pool through Kubernetes cluster autoscaler.
	Autoscaling bool `json:"autoscaling"`

	Provider string `json:"provider"`

	ProviderConfig map[string]interface{} `json:"providerConfig"`

	Hosts []PkeHosts `json:"hosts,omitempty"`
}

// AssertNodePoolsPkeRequired checks if the required fields are not zero-ed
func AssertNodePoolsPkeRequired(obj NodePoolsPke) error {
	elements := map[string]interface{}{
		"name": obj.Name,
		"roles": obj.Roles,
		"autoscaling": obj.Autoscaling,
		"provider": obj.Provider,
		"providerConfig": obj.ProviderConfig,
	}
	for name, el := range elements {
		if isZero := IsZeroValue(el); isZero {
			return &RequiredError{Field: name}
		}
	}

	for _, el := range obj.Hosts {
		if err := AssertPkeHostsRequired(el); err != nil {
			return err
		}
	}
	return nil
}

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