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

	Name string `json:"name"`

	Roles []string `json:"roles"`

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

	Size int32 `json:"size,omitempty"`

	// Number of VCPUs to attach to each node.
	Vcpu int32 `json:"vcpu"`

	// MiBs of RAM to attach to each node.
	Ram int32 `json:"ram"`

	// Name of VM template available on vSphere to clone as the base of nodes. Overrides default value from the main cluster secret.
	Template string `json:"template,omitempty"`

	// Name of admin user to deploy the generated SSH public key for. No key will be deployed if omitted.
	AdminUsername string `json:"adminUsername,omitempty"`
}

// AssertPkeonVsphereNodePoolRequired checks if the required fields are not zero-ed
func AssertPkeonVsphereNodePoolRequired(obj PkeonVsphereNodePool) error {
	elements := map[string]interface{}{
		"name": obj.Name,
		"roles": obj.Roles,
		"vcpu": obj.Vcpu,
		"ram": obj.Ram,
	}
	for name, el := range elements {
		if isZero := IsZeroValue(el); isZero {
			return &RequiredError{Field: name}
		}
	}

	return nil
}

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