storage

package
v1.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultStorageAccountType is the default storage account type
	DefaultStorageAccountType = string(armstorage.SKUNameStandardLRS)
	// DefaultStorageAccountKind is the default storage account kind
	DefaultStorageAccountKind = armstorage.KindStorageV2
	// FileShareAccountNamePrefix is the file share account name prefix
	FileShareAccountNamePrefix = "f"
	// SharedDiskAccountNamePrefix is the shared disk account name prefix
	SharedDiskAccountNamePrefix = "ds"
	// DedicatedDiskAccountNamePrefix is the dedicated disk account name prefix
	DedicatedDiskAccountNamePrefix = "dd"
)
View Source
const DefaultTokenAudience = "api://AzureADTokenExchange" //nolint:gosec // G101 ignore this!
View Source
const LocationGlobal = "global"
View Source
const SkipMatchingTag = "skip-matching"

SkipMatchingTag skip account matching tag

Variables

This section is empty.

Functions

func AreVNetRulesEqual added in v1.32.0

func AreVNetRulesEqual(account *armstorage.Account, accountOptions *AccountOptions) bool

func GetStorageAccesskey

func GetStorageAccesskey(ctx context.Context, saClient accountclient.Interface, account, resourceGroup string, getLatestAccountKey bool) (string, error)

GetStorageAccesskey gets the storage account access key getLatestAccountKey: get the latest account key per CreationTime if true, otherwise get the first account key

Types

type AccountOptions added in v1.32.0

type AccountOptions struct {
	SubscriptionID                            string
	Name, Type, Kind, ResourceGroup, Location string
	EnableHTTPSTrafficOnly                    bool
	// indicate whether create new account when Name is empty or when account does not exists
	CreateAccount                           bool
	CreatePrivateEndpoint                   *bool
	StorageType                             Type
	StorageEndpointSuffix                   string
	DisableFileServiceDeleteRetentionPolicy *bool
	EnableLargeFileShare                    *bool
	IsHnsEnabled                            *bool
	EnableNfsV3                             *bool
	AllowBlobPublicAccess                   *bool
	RequireInfrastructureEncryption         *bool
	AllowSharedKeyAccess                    *bool
	IsMultichannelEnabled                   *bool
	KeyName                                 *string
	KeyVersion                              *string
	KeyVaultURI                             *string
	Tags                                    map[string]string
	VirtualNetworkResourceIDs               []string
	VNetResourceGroup                       string
	VNetName                                string
	SubnetName                              string
	AccessTier                              string
	MatchTags                               bool
	GetLatestAccountKey                     bool
	EnableBlobVersioning                    *bool
	SoftDeleteBlobs                         int32
	SoftDeleteContainers                    int32
	// indicate whether to get a random matching account, if false, will get the first matching account
	PickRandomMatchingAccount bool
	// provide the source account name in snapshot restore and volume clone scenarios
	SourceAccountName string
	// default is "privatelink"
	PrivateDNSZoneName string
}

AccountOptions contains the fields which are used to create storage account.

type AccountRepo added in v1.32.0

type AccountRepo struct {
	azureconfig.Config
	Environment          *azclient.Environment
	ComputeClientFactory azclient.ClientFactory
	NetworkClientFactory azclient.ClientFactory
	// contains filtered or unexported fields
}

func NewRepository added in v1.32.0

func NewRepository(config azureconfig.Config, env *azclient.Environment, computeClientFactory azclient.ClientFactory, networkClientFactory azclient.ClientFactory) (*AccountRepo, error)

func (*AccountRepo) AddStorageAccountTags added in v1.32.0

func (az *AccountRepo) AddStorageAccountTags(ctx context.Context, subsID, resourceGroup, account string, tags map[string]*string) error

AddStorageAccountTags add tags to storage account

func (*AccountRepo) EnsureStorageAccount added in v1.32.0

func (az *AccountRepo) EnsureStorageAccount(ctx context.Context, accountOptions *AccountOptions, genAccountNamePrefix string) (string, string, error)

EnsureStorageAccount search storage account, create one storage account(with genAccountNamePrefix) if not found, return accountName, accountKey

func (*AccountRepo) GetStorageAccesskey added in v1.32.0

func (az *AccountRepo) GetStorageAccesskey(ctx context.Context, accountClient accountclient.Interface, account, resourceGroup string, getLatestAccountKey bool) (string, error)

GetStorageAccesskey gets the storage account access key getLatestAccountKey: get the latest account key per CreationTime if true, otherwise get the first account key

func (*AccountRepo) GetStorageAccesskeyFromServiceAccountToken added in v1.32.0

func (az *AccountRepo) GetStorageAccesskeyFromServiceAccountToken(ctx context.Context, subsID, accountName, rgName, clientID, tenantID, serviceAccountToken string) (string, error)

func (*AccountRepo) RemoveStorageAccountTag added in v1.32.0

func (az *AccountRepo) RemoveStorageAccountTag(ctx context.Context, subsID, resourceGroup, account, key string) error

RemoveStorageAccountTag remove tag from storage account

type Type added in v1.32.0

type Type string
const (
	StorageTypeBlob Type = "blob"
	StorageTypeFile Type = "file"
)

Directories

Path Synopsis
mock_fileservice
Package mock_fileservice is a generated GoMock package.
Package mock_fileservice is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL