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

import "github.com/Azure/azure-service-operator/v2/pkg/genruntime"

type StorageAccountsManagementPolicy_Spec struct {
	Name string `json:"name,omitempty"`

	// Properties: Returns the Storage Account Data Policies Rules.
	Properties *ManagementPolicyProperties `json:"properties,omitempty"`
}

var _ genruntime.ARMResourceSpec = &StorageAccountsManagementPolicy_Spec{}

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

// GetName returns the Name of the resource
func (policy *StorageAccountsManagementPolicy_Spec) GetName() string {
	return policy.Name
}

// GetType returns the ARM Type of the resource. This is always "Microsoft.Storage/storageAccounts/managementPolicies"
func (policy *StorageAccountsManagementPolicy_Spec) GetType() string {
	return "Microsoft.Storage/storageAccounts/managementPolicies"
}

// The Storage Account ManagementPolicy properties.
type ManagementPolicyProperties struct {
	// Policy: The Storage Account ManagementPolicy, in JSON format. See more details in:
	// https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.
	Policy *ManagementPolicySchema `json:"policy,omitempty"`
}

// The Storage Account ManagementPolicies Rules. See more details in:
// https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.
type ManagementPolicySchema struct {
	// Rules: The Storage Account ManagementPolicies Rules. See more details in:
	// https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.
	Rules []ManagementPolicyRule `json:"rules"`
}

// An object that wraps the Lifecycle rule. Each rule is uniquely defined by name.
type ManagementPolicyRule struct {
	// Definition: An object that defines the Lifecycle rule.
	Definition *ManagementPolicyDefinition `json:"definition,omitempty"`

	// Enabled: Rule is enabled if set to true.
	Enabled *bool `json:"enabled,omitempty"`

	// Name: A rule name can contain any combination of alpha numeric characters. Rule name is case-sensitive. It must be
	// unique within a policy.
	Name *string `json:"name,omitempty"`

	// Type: The valid value is Lifecycle
	Type *ManagementPolicyRule_Type `json:"type,omitempty"`
}

// An object that defines the Lifecycle rule. Each definition is made up with a filters set and an actions set.
type ManagementPolicyDefinition struct {
	// Actions: An object that defines the action set.
	Actions *ManagementPolicyAction `json:"actions,omitempty"`

	// Filters: An object that defines the filter set.
	Filters *ManagementPolicyFilter `json:"filters,omitempty"`
}

// +kubebuilder:validation:Enum={"Lifecycle"}
type ManagementPolicyRule_Type string

const ManagementPolicyRule_Type_Lifecycle = ManagementPolicyRule_Type("Lifecycle")

// Mapping from string to ManagementPolicyRule_Type
var managementPolicyRule_Type_Values = map[string]ManagementPolicyRule_Type{
	"lifecycle": ManagementPolicyRule_Type_Lifecycle,
}

// Actions are applied to the filtered blobs when the execution condition is met.
type ManagementPolicyAction struct {
	// BaseBlob: The management policy action for base blob
	BaseBlob *ManagementPolicyBaseBlob `json:"baseBlob,omitempty"`

	// Snapshot: The management policy action for snapshot
	Snapshot *ManagementPolicySnapShot `json:"snapshot,omitempty"`

	// Version: The management policy action for version
	Version *ManagementPolicyVersion `json:"version,omitempty"`
}

// Filters limit rule actions to a subset of blobs within the storage account. If multiple filters are defined, a logical
// AND is performed on all filters.
type ManagementPolicyFilter struct {
	// BlobIndexMatch: An array of blob index tag based filters, there can be at most 10 tag filters
	BlobIndexMatch []TagFilter `json:"blobIndexMatch"`

	// BlobTypes: An array of predefined enum values. Currently blockBlob supports all tiering and delete actions. Only delete
	// actions are supported for appendBlob.
	BlobTypes []string `json:"blobTypes"`

	// PrefixMatch: An array of strings for prefixes to be match.
	PrefixMatch []string `json:"prefixMatch"`
}

// Management policy action for base blob.
type ManagementPolicyBaseBlob struct {
	// Delete: The function to delete the blob
	Delete *DateAfterModification `json:"delete,omitempty"`

	// EnableAutoTierToHotFromCool: This property enables auto tiering of a blob from cool to hot on a blob access. This
	// property requires tierToCool.daysAfterLastAccessTimeGreaterThan.
	EnableAutoTierToHotFromCool *bool `json:"enableAutoTierToHotFromCool,omitempty"`

	// TierToArchive: The function to tier blobs to archive storage.
	TierToArchive *DateAfterModification `json:"tierToArchive,omitempty"`

	// TierToCold: The function to tier blobs to cold storage.
	TierToCold *DateAfterModification `json:"tierToCold,omitempty"`

	// TierToCool: The function to tier blobs to cool storage.
	TierToCool *DateAfterModification `json:"tierToCool,omitempty"`

	// TierToHot: The function to tier blobs to hot storage. This action can only be used with Premium Block Blob Storage
	// Accounts
	TierToHot *DateAfterModification `json:"tierToHot,omitempty"`
}

// Management policy action for snapshot.
type ManagementPolicySnapShot struct {
	// Delete: The function to delete the blob snapshot
	Delete *DateAfterCreation `json:"delete,omitempty"`

	// TierToArchive: The function to tier blob snapshot to archive storage.
	TierToArchive *DateAfterCreation `json:"tierToArchive,omitempty"`

	// TierToCold: The function to tier blobs to cold storage.
	TierToCold *DateAfterCreation `json:"tierToCold,omitempty"`

	// TierToCool: The function to tier blob snapshot to cool storage.
	TierToCool *DateAfterCreation `json:"tierToCool,omitempty"`

	// TierToHot: The function to tier blobs to hot storage. This action can only be used with Premium Block Blob Storage
	// Accounts
	TierToHot *DateAfterCreation `json:"tierToHot,omitempty"`
}

// Management policy action for blob version.
type ManagementPolicyVersion struct {
	// Delete: The function to delete the blob version
	Delete *DateAfterCreation `json:"delete,omitempty"`

	// TierToArchive: The function to tier blob version to archive storage.
	TierToArchive *DateAfterCreation `json:"tierToArchive,omitempty"`

	// TierToCold: The function to tier blobs to cold storage.
	TierToCold *DateAfterCreation `json:"tierToCold,omitempty"`

	// TierToCool: The function to tier blob version to cool storage.
	TierToCool *DateAfterCreation `json:"tierToCool,omitempty"`

	// TierToHot: The function to tier blobs to hot storage. This action can only be used with Premium Block Blob Storage
	// Accounts
	TierToHot *DateAfterCreation `json:"tierToHot,omitempty"`
}

// Blob index tag based filtering for blob objects
type TagFilter struct {
	// Name: This is the filter tag name, it can have 1 - 128 characters
	Name *string `json:"name,omitempty"`

	// Op: This is the comparison operator which is used for object comparison and filtering. Only == (equality operator) is
	// currently supported
	Op *string `json:"op,omitempty"`

	// Value: This is the filter tag value field used for tag based filtering, it can have 0 - 256 characters
	Value *string `json:"value,omitempty"`
}

// Object to define snapshot and version action conditions.
type DateAfterCreation struct {
	// DaysAfterCreationGreaterThan: Value indicating the age in days after creation
	DaysAfterCreationGreaterThan *int `json:"daysAfterCreationGreaterThan,omitempty"`

	// DaysAfterLastTierChangeGreaterThan: Value indicating the age in days after last blob tier change time. This property is
	// only applicable for tierToArchive actions and requires daysAfterCreationGreaterThan to be set for snapshots and blob
	// version based actions. The blob will be archived if both the conditions are satisfied.
	DaysAfterLastTierChangeGreaterThan *int `json:"daysAfterLastTierChangeGreaterThan,omitempty"`
}

// Object to define the base blob action conditions. Properties daysAfterModificationGreaterThan,
// daysAfterLastAccessTimeGreaterThan and daysAfterCreationGreaterThan are mutually exclusive. The
// daysAfterLastTierChangeGreaterThan property is only applicable for tierToArchive actions which requires
// daysAfterModificationGreaterThan to be set, also it cannot be used in conjunction with
// daysAfterLastAccessTimeGreaterThan or daysAfterCreationGreaterThan.
type DateAfterModification struct {
	// DaysAfterCreationGreaterThan: Value indicating the age in days after blob creation.
	DaysAfterCreationGreaterThan *int `json:"daysAfterCreationGreaterThan,omitempty"`

	// DaysAfterLastAccessTimeGreaterThan: Value indicating the age in days after last blob access. This property can only be
	// used in conjunction with last access time tracking policy
	DaysAfterLastAccessTimeGreaterThan *int `json:"daysAfterLastAccessTimeGreaterThan,omitempty"`

	// DaysAfterLastTierChangeGreaterThan: Value indicating the age in days after last blob tier change time. This property is
	// only applicable for tierToArchive actions and requires daysAfterModificationGreaterThan to be set for baseBlobs based
	// actions. The blob will be archived if both the conditions are satisfied.
	DaysAfterLastTierChangeGreaterThan *int `json:"daysAfterLastTierChangeGreaterThan,omitempty"`

	// DaysAfterModificationGreaterThan: Value indicating the age in days after last modification
	DaysAfterModificationGreaterThan *int `json:"daysAfterModificationGreaterThan,omitempty"`
}
