// Code generated by azure-service-operator-codegen. DO NOT EDIT.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package v1api20220901storage

import (
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions"
	"github.com/pkg/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
)

// +kubebuilder:rbac:groups=storage.azure.com,resources=storageaccountsfileservicesshares,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=storage.azure.com,resources={storageaccountsfileservicesshares/status,storageaccountsfileservicesshares/finalizers},verbs=get;update;patch

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message"
// Storage version of v1api20220901.StorageAccountsFileServicesShare
// Generator information:
// - Generated from: /storage/resource-manager/Microsoft.Storage/stable/2022-09-01/file.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}
type StorageAccountsFileServicesShare struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              StorageAccounts_FileServices_Share_Spec   `json:"spec,omitempty"`
	Status            StorageAccounts_FileServices_Share_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &StorageAccountsFileServicesShare{}

// GetConditions returns the conditions of the resource
func (share *StorageAccountsFileServicesShare) GetConditions() conditions.Conditions {
	return share.Status.Conditions
}

// SetConditions sets the conditions on the resource status
func (share *StorageAccountsFileServicesShare) SetConditions(conditions conditions.Conditions) {
	share.Status.Conditions = conditions
}

var _ genruntime.KubernetesResource = &StorageAccountsFileServicesShare{}

// AzureName returns the Azure name of the resource
func (share *StorageAccountsFileServicesShare) AzureName() string {
	return share.Spec.AzureName
}

// GetAPIVersion returns the ARM API version of the resource. This is always "2022-09-01"
func (share StorageAccountsFileServicesShare) GetAPIVersion() string {
	return string(APIVersion_Value)
}

// GetResourceScope returns the scope of the resource
func (share *StorageAccountsFileServicesShare) GetResourceScope() genruntime.ResourceScope {
	return genruntime.ResourceScopeResourceGroup
}

// GetSpec returns the specification of this resource
func (share *StorageAccountsFileServicesShare) GetSpec() genruntime.ConvertibleSpec {
	return &share.Spec
}

// GetStatus returns the status of this resource
func (share *StorageAccountsFileServicesShare) GetStatus() genruntime.ConvertibleStatus {
	return &share.Status
}

// GetType returns the ARM Type of the resource. This is always "Microsoft.Storage/storageAccounts/fileServices/shares"
func (share *StorageAccountsFileServicesShare) GetType() string {
	return "Microsoft.Storage/storageAccounts/fileServices/shares"
}

// NewEmptyStatus returns a new empty (blank) status
func (share *StorageAccountsFileServicesShare) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &StorageAccounts_FileServices_Share_STATUS{}
}

// Owner returns the ResourceReference of the owner
func (share *StorageAccountsFileServicesShare) Owner() *genruntime.ResourceReference {
	group, kind := genruntime.LookupOwnerGroupKind(share.Spec)
	return share.Spec.Owner.AsResourceReference(group, kind)
}

// SetStatus sets the status of this resource
func (share *StorageAccountsFileServicesShare) SetStatus(status genruntime.ConvertibleStatus) error {
	// If we have exactly the right type of status, assign it
	if st, ok := status.(*StorageAccounts_FileServices_Share_STATUS); ok {
		share.Status = *st
		return nil
	}

	// Convert status to required version
	var st StorageAccounts_FileServices_Share_STATUS
	err := status.ConvertStatusTo(&st)
	if err != nil {
		return errors.Wrap(err, "failed to convert status")
	}

	share.Status = st
	return nil
}

// Hub marks that this StorageAccountsFileServicesShare is the hub type for conversion
func (share *StorageAccountsFileServicesShare) Hub() {}

// OriginalGVK returns a GroupValueKind for the original API version used to create the resource
func (share *StorageAccountsFileServicesShare) OriginalGVK() *schema.GroupVersionKind {
	return &schema.GroupVersionKind{
		Group:   GroupVersion.Group,
		Version: share.Spec.OriginalVersion,
		Kind:    "StorageAccountsFileServicesShare",
	}
}

// +kubebuilder:object:root=true
// Storage version of v1api20220901.StorageAccountsFileServicesShare
// Generator information:
// - Generated from: /storage/resource-manager/Microsoft.Storage/stable/2022-09-01/file.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}
type StorageAccountsFileServicesShareList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []StorageAccountsFileServicesShare `json:"items"`
}

// Storage version of v1api20220901.StorageAccounts_FileServices_Share_Spec
type StorageAccounts_FileServices_Share_Spec struct {
	AccessTier *string `json:"accessTier,omitempty"`

	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:MinLength=3
	// AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it
	// doesn't have to be.
	AzureName        string            `json:"azureName,omitempty"`
	EnabledProtocols *string           `json:"enabledProtocols,omitempty"`
	Metadata         map[string]string `json:"metadata,omitempty"`
	OriginalVersion  string            `json:"originalVersion,omitempty"`

	// +kubebuilder:validation:Required
	// Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also
	// controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a
	// reference to a storage.azure.com/StorageAccountsFileService resource
	Owner             *genruntime.KnownResourceReference `group:"storage.azure.com" json:"owner,omitempty" kind:"StorageAccountsFileService"`
	PropertyBag       genruntime.PropertyBag             `json:"$propertyBag,omitempty"`
	RootSquash        *string                            `json:"rootSquash,omitempty"`
	ShareQuota        *int                               `json:"shareQuota,omitempty"`
	SignedIdentifiers []SignedIdentifier                 `json:"signedIdentifiers,omitempty"`
}

var _ genruntime.ConvertibleSpec = &StorageAccounts_FileServices_Share_Spec{}

// ConvertSpecFrom populates our StorageAccounts_FileServices_Share_Spec from the provided source
func (share *StorageAccounts_FileServices_Share_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error {
	if source == share {
		return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec")
	}

	return source.ConvertSpecTo(share)
}

// ConvertSpecTo populates the provided destination from our StorageAccounts_FileServices_Share_Spec
func (share *StorageAccounts_FileServices_Share_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error {
	if destination == share {
		return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec")
	}

	return destination.ConvertSpecFrom(share)
}

// Storage version of v1api20220901.StorageAccounts_FileServices_Share_STATUS
type StorageAccounts_FileServices_Share_STATUS struct {
	AccessTier             *string                   `json:"accessTier,omitempty"`
	AccessTierChangeTime   *string                   `json:"accessTierChangeTime,omitempty"`
	AccessTierStatus       *string                   `json:"accessTierStatus,omitempty"`
	Conditions             []conditions.Condition    `json:"conditions,omitempty"`
	Deleted                *bool                     `json:"deleted,omitempty"`
	DeletedTime            *string                   `json:"deletedTime,omitempty"`
	EnabledProtocols       *string                   `json:"enabledProtocols,omitempty"`
	Etag                   *string                   `json:"etag,omitempty"`
	Id                     *string                   `json:"id,omitempty"`
	LastModifiedTime       *string                   `json:"lastModifiedTime,omitempty"`
	LeaseDuration          *string                   `json:"leaseDuration,omitempty"`
	LeaseState             *string                   `json:"leaseState,omitempty"`
	LeaseStatus            *string                   `json:"leaseStatus,omitempty"`
	Metadata               map[string]string         `json:"metadata,omitempty"`
	Name                   *string                   `json:"name,omitempty"`
	PropertyBag            genruntime.PropertyBag    `json:"$propertyBag,omitempty"`
	RemainingRetentionDays *int                      `json:"remainingRetentionDays,omitempty"`
	RootSquash             *string                   `json:"rootSquash,omitempty"`
	ShareQuota             *int                      `json:"shareQuota,omitempty"`
	ShareUsageBytes        *int                      `json:"shareUsageBytes,omitempty"`
	SignedIdentifiers      []SignedIdentifier_STATUS `json:"signedIdentifiers,omitempty"`
	SnapshotTime           *string                   `json:"snapshotTime,omitempty"`
	Type                   *string                   `json:"type,omitempty"`
	Version                *string                   `json:"version,omitempty"`
}

var _ genruntime.ConvertibleStatus = &StorageAccounts_FileServices_Share_STATUS{}

// ConvertStatusFrom populates our StorageAccounts_FileServices_Share_STATUS from the provided source
func (share *StorageAccounts_FileServices_Share_STATUS) ConvertStatusFrom(source genruntime.ConvertibleStatus) error {
	if source == share {
		return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus")
	}

	return source.ConvertStatusTo(share)
}

// ConvertStatusTo populates the provided destination from our StorageAccounts_FileServices_Share_STATUS
func (share *StorageAccounts_FileServices_Share_STATUS) ConvertStatusTo(destination genruntime.ConvertibleStatus) error {
	if destination == share {
		return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus")
	}

	return destination.ConvertStatusFrom(share)
}

// Storage version of v1api20220901.SignedIdentifier
type SignedIdentifier struct {
	AccessPolicy *AccessPolicy          `json:"accessPolicy,omitempty"`
	PropertyBag  genruntime.PropertyBag `json:"$propertyBag,omitempty"`

	// Reference: An unique identifier of the stored access policy.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

// Storage version of v1api20220901.SignedIdentifier_STATUS
type SignedIdentifier_STATUS struct {
	AccessPolicy *AccessPolicy_STATUS   `json:"accessPolicy,omitempty"`
	Id           *string                `json:"id,omitempty"`
	PropertyBag  genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20220901.AccessPolicy
type AccessPolicy struct {
	ExpiryTime  *string                `json:"expiryTime,omitempty"`
	Permission  *string                `json:"permission,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	StartTime   *string                `json:"startTime,omitempty"`
}

// Storage version of v1api20220901.AccessPolicy_STATUS
type AccessPolicy_STATUS struct {
	ExpiryTime  *string                `json:"expiryTime,omitempty"`
	Permission  *string                `json:"permission,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	StartTime   *string                `json:"startTime,omitempty"`
}

func init() {
	SchemeBuilder.Register(&StorageAccountsFileServicesShare{}, &StorageAccountsFileServicesShareList{})
}
