azure

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: Apache-2.0 Imports: 22 Imported by: 2

Documentation

Overview

Package azure provides an abstraction for the Microsoft Azure Storage service. In this package, an Azure Resource of type "Storage account" is represented by a Stow Location and an Azure blob is represented by a Stow Item.

Usage and Credentials

stow.Dial requires both a string value of the particular Stow Location Kind ("azure") and a stow.Config instance. The list below outlines all configuration values:

- a key of azure.ConfigAccount with a value of the Azure Resource Name - a key of azure.ConfigKey with a value of the Azure Access Key (only used with shared key authentication) - an optional key of azure.ConfigDomainSuffix to specify the Azure API domain. Defaults to `core.windows.net` (public Azure) - an optional key of azure.ConfigUploadConcurrency to specify the upload concurrency to use. Defaults to `4`.

## Authentication Methods

There are two ways to authenticate to a Microsoft Azure Storage account:

- Shared Key Authentication ([Discouraged by MSFT](https://tinyurl.com/3umn4hpn)) - Azure AD Authentication (requires Role Assignments)

### Shared Key Authentication

To perform shared key authentication, the configuration must include the `azure.ConfigKey` property and the storage account must not prevent the use of shared keys ([MSFT reference here](https://tinyurl.com/3dxkzh99))

### Azure AD Authentication

Azure AD authentication is resolved using the Default credential, which performs a hunt for credentials in the environment in a cross-SDK and cross-platform way. The documentation for the resolution process [can be found here](https://tinyurl.com/5ajy83c9).

Location

There are azure.location methods which allow the retrieval of a single Azure Storage Service. A stow.Item representation of an Azure Storage Blob can also be retrieved based on the Object's URL (ItemByURL).

Additional azure.location methods provide capabilities to create and remove Azure Storage Containers.

Container

Methods of an azure.container allow the retrieval of an Azure Storage Container's:

- name (ID or Name) - blob or complete list of blobs (Item or Items)

Additional azure.container methods allow Stow to :

- remove a Blob (RemoveItem) - update or create a Blob (Put)

Item

Methods of azure.Item allow the retrieval of an Azure Storage Container's: - name (ID or name) - URL - size in bytes - Azure Storage blob specific metadata (information stored within the Azure Cloud Service) - last modified date - Etag - content

Index

Constants

View Source
const (
	ConfigAccount            = "account"
	ConfigKey                = "key"
	ConfigDomainSuffix       = "domain_suffix"
	ConfigUploadConcurrency  = "upload_concurrency"
	ConfigBaseUrlDepreciated = "base_url"
)

ConfigAccount should be the name of your storage account in the Azure portal ConfigKey should be an access key ConfigDomainSuffix the domain suffix to use for storage account communication. The default is the Azure Public cloud ConfigUploadConcurrency the upload concurrency to use when uploading. Default is 4. ConfigBaseUrlDepreciated Kept for backwards compatability, use ConfigDomainSuffix instead

View Source
const (
	ConfigUseHttpsRemoved   = "use_https"
	ConfigApiVersionRemoved = "api_version"
)

Removed configuration values, will cause failures if used.

View Source
const Kind = "azure"

Kind is the kind of Location this package provides.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlobProps

type BlobProps struct {
	ETag          azcore.ETag
	LastModified  time.Time
	ContentLength int64
}

BlobProps are the only blob properties required for stow.

type RequestPreSigner

type RequestPreSigner func(ctx context.Context, values sas.BlobSignatureValues) (sas.QueryParameters, error)

RequestPreSigner is a facade for pre-signing blob requests, regardless of how authentication was performed.

func NewDelegatedKeyPreSigner

func NewDelegatedKeyPreSigner(serviceClient *service.Client) (RequestPreSigner, error)

NewDelegatedKeyPreSigner will create a RequestPreSigner that worked with delegated credentials, necessary when identity-based authentication (AD auth) is the used with the SDK.

func NewSharedKeyRequestPreSigner

func NewSharedKeyRequestPreSigner(accountName, key string) (RequestPreSigner, error)

NewSharedKeyRequestPreSigner will create a RequestPreSigner when a shared key is used as the authentication method.

Jump to

Keyboard shortcuts

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