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

	Name string `json:"name"`

	SecretId string `json:"secretId,omitempty"`

	SecretName string `json:"secretName,omitempty"`

	SshSecretId string `json:"sshSecretId,omitempty"`

	Type string `json:"type"`

	Kubernetes CreatePkeClusterKubernetes `json:"kubernetes"`

	Proxy PkeClusterHttpProxy `json:"proxy,omitempty"`

	// Non-existent resources will be created in this location. Existing resources that must have the same location as the cluster will be validated against this.
	Location string `json:"location,omitempty"`

	// Required resources will be created in this resource group.
	ResourceGroup string `json:"resourceGroup"`

	Network PkeonAzureClusterNetwork `json:"network,omitempty"`

	// List of access points (i.e. load balancers, floating IPs) to be created for the cluster. Access points are implemented using cloud provider specific resources.
	AccessPoints []string `json:"accessPoints,omitempty"`

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

	Nodepools []PkeonAzureNodePool `json:"nodepools,omitempty"`
}

// AssertCreatePkeonAzureClusterRequestRequired checks if the required fields are not zero-ed
func AssertCreatePkeonAzureClusterRequestRequired(obj CreatePkeonAzureClusterRequest) error {
	elements := map[string]interface{}{
		"name": obj.Name,
		"type": obj.Type,
		"kubernetes": obj.Kubernetes,
		"resourceGroup": obj.ResourceGroup,
	}
	for name, el := range elements {
		if isZero := IsZeroValue(el); isZero {
			return &RequiredError{Field: name}
		}
	}

	if err := AssertCreatePkeClusterKubernetesRequired(obj.Kubernetes); err != nil {
		return err
	}
	if err := AssertPkeClusterHttpProxyRequired(obj.Proxy); err != nil {
		return err
	}
	if err := AssertPkeonAzureClusterNetworkRequired(obj.Network); err != nil {
		return err
	}
	for _, el := range obj.Nodepools {
		if err := AssertPkeonAzureNodePoolRequired(el); err != nil {
			return err
		}
	}
	return nil
}

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