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

	// the name of the object storage / bucket
	Name string `json:"name"`

	// true if the bucket has been created via pipeline
	Managed bool `json:"managed"`

	// cloud provider of the bucket
	Cloud string `json:"cloud"`

	// location of the bucket
	Location string `json:"location"`

	// notes for the bucket
	Notes string `json:"notes,omitempty"`

	Secret BucketInfoSecret `json:"secret,omitempty"`

	Aks AzureBlobStorageProps `json:"aks,omitempty"`

	// the status of the bucket
	Status string `json:"status"`

	// the reason for the error status
	StatusMessage string `json:"statusMessage,omitempty"`
}

// AssertBucketInfoRequired checks if the required fields are not zero-ed
func AssertBucketInfoRequired(obj BucketInfo) error {
	elements := map[string]interface{}{
		"name": obj.Name,
		"managed": obj.Managed,
		"cloud": obj.Cloud,
		"location": obj.Location,
		"status": obj.Status,
	}
	for name, el := range elements {
		if isZero := IsZeroValue(el); isZero {
			return &RequiredError{Field: name}
		}
	}

	if err := AssertBucketInfoSecretRequired(obj.Secret); err != nil {
		return err
	}
	if err := AssertAzureBlobStoragePropsRequired(obj.Aks); err != nil {
		return err
	}
	return nil
}

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