storage

package
v27.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2019 License: Apache-2.0 Imports: 30 Imported by: 0

README

Azure Storage SDK for Go (Preview)

❗ IMPORTANT: This package is in maintenance only and will be deprecated in the future. Please use one of the following packages instead.

Service Import Path/Repo
Storage - Blobs github.com/Azure/azure-storage-blob-go
Storage - Files github.com/Azure/azure-storage-file-go
Storage - Queues github.com/Azure/azure-storage-queue-go

The github.com/Azure/azure-sdk-for-go/storage package is used to manage Azure Storage data plane resources: containers, blobs, tables, and queues.

To manage storage accounts use Azure Resource Manager (ARM) via the packages at github.com/Azure/azure-sdk-for-go/services/storage.

This package also supports the Azure Storage Emulator (Windows only).

Documentation

Overview

Package storage provides clients for Microsoft Azure Storage Services.

Package storage provides clients for Microsoft Azure Storage Services.

Index

Constants

View Source
const (
	MaxBlobBlockSize = 100 * 1024 * 1024
	MaxBlobPageSize  = 4 * 1024 * 1024
)

Maximum sizes (per REST API) for various concepts

View Source
const (
	// DefaultBaseURL is the domain name used for storage requests in the
	// public cloud when a default client is created.
	DefaultBaseURL = "core.windows.net"

	// DefaultAPIVersion is the Azure Storage API version string used when a
	// basic client is created.
	DefaultAPIVersion = "2016-05-31"

	// StorageEmulatorAccountName is the fixed storage account used by Azure Storage Emulator
	StorageEmulatorAccountName = "devstoreaccount1"

	// StorageEmulatorAccountKey is the the fixed storage account used by Azure Storage Emulator
	StorageEmulatorAccountKey = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
)
View Source
const (
	OdataTypeSuffix = "@odata.type"

	OdataBinary   = "Edm.Binary"
	OdataDateTime = "Edm.DateTime"
	OdataGUID     = "Edm.Guid"
	OdataInt64    = "Edm.Int64"

	OdataFilter  = "$filter"
	OdataOrderBy = "$orderby"
	OdataTop     = "$top"
	OdataSkip    = "$skip"
	OdataCount   = "$count"
	OdataExpand  = "$expand"
	OdataSelect  = "$select"
	OdataSearch  = "$search"

	EmptyPayload    MetadataLevel = ""
	NoMetadata      MetadataLevel = "application/json;odata=nometadata"
	MinimalMetadata MetadataLevel = "application/json;odata=minimalmetadata"
	FullMetadata    MetadataLevel = "application/json;odata=fullmetadata"
)

This consts are meant to help with Odata supported operations

View Source
const (
	InsertOp          = Operation(1)
	DeleteOp          = Operation(2)
	ReplaceOp         = Operation(3)
	MergeOp           = Operation(4)
	InsertOrReplaceOp = Operation(5)
	InsertOrMergeOp   = Operation(6)
)

consts for batch operations.

View Source
const (
	ContainerAccessHeader string = "x-ms-blob-public-access"
)

ContainerAccessHeader references header used when setting/getting container ACL

View Source
const MaxFileSize = oneTB
View Source
const MaxRangeSize = fourMB

Export maximum range and file sizes

Variables

This section is empty.

Functions

func IsValidStorageAccount

func IsValidStorageAccount(account string) bool

IsValidStorageAccount checks if the storage account name is valid. See https://docs.microsoft.com/en-us/azure/storage/storage-create-storage-account

Types

type AbortCopyOptions

type AbortCopyOptions struct {
	Timeout   uint
	LeaseID   string `header:"x-ms-lease-id"`
	RequestID string `header:"x-ms-client-request-id"`
}

AbortCopyOptions includes the options for an abort blob operation

type AccessPolicy

type AccessPolicy struct {
	SignedIdentifiersList SignedIdentifiers `xml:"SignedIdentifiers"`
}

AccessPolicy is the response type from the GetPermissions call.

type AccessPolicyDetailsXML

type AccessPolicyDetailsXML struct {
	StartTime  time.Time `xml:"Start"`
	ExpiryTime time.Time `xml:"Expiry"`
	Permission string    `xml:"Permission"`
}

AccessPolicyDetailsXML has specifics about an access policy annotated with XML details.

type AccountSASTokenOptions

type AccountSASTokenOptions struct {
	APIVersion    string
	Services      Services
	ResourceTypes ResourceTypes
	Permissions   Permissions
	Start         time.Time
	Expiry        time.Time
	IP            string
	UseHTTPS      bool
}

AccountSASTokenOptions includes options for constructing an account SAS token. https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas

type AppendBlockOptions

type AppendBlockOptions struct {
	Timeout           uint
	LeaseID           string     `header:"x-ms-lease-id"`
	MaxSize           *uint      `header:"x-ms-blob-condition-maxsize"`
	AppendPosition    *uint      `header:"x-ms-blob-condition-appendpos"`
	IfModifiedSince   *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
	IfMatch           string     `header:"If-Match"`
	IfNoneMatch       string     `header:"If-None-Match"`
	RequestID         string     `header:"x-ms-client-request-id"`
	ContentMD5        bool
}

AppendBlockOptions includes the options for an append block operation

type AzureStorageServiceError

type AzureStorageServiceError struct {
	Code                      string `xml:"Code"`
	Message                   string `xml:"Message"`
	AuthenticationErrorDetail string `xml:"AuthenticationErrorDetail"`
	QueryParameterName        string `xml:"QueryParameterName"`
	QueryParameterValue       string `xml:"QueryParameterValue"`
	Reason                    string `xml:"Reason"`
	Lang                      string
	StatusCode                int
	RequestID                 string
	Date                      string
	APIVersion                string
}

AzureStorageServiceError contains fields of the error response from Azure Storage Service REST API. See https://msdn.microsoft.com/en-us/library/azure/dd179382.aspx Some fields might be specific to certain calls.

func (AzureStorageServiceError) Error

func (e AzureStorageServiceError) Error() string

type BatchEntity

type BatchEntity struct {
	*Entity
	Force bool
	Op    Operation
}

BatchEntity used for tracking Entities to operate on and whether operations (replace/merge etc) should be forced. Wrapper for regular Entity with additional data specific for the entity.

type Blob

type Blob struct {
	Container  *Container
	Name       string         `xml:"Name"`
	Snapshot   time.Time      `xml:"Snapshot"`
	Properties BlobProperties `xml:"Properties"`
	Metadata   BlobMetadata   `xml:"Metadata"`
}

A Blob is an entry in BlobListResponse.

func (*Blob) AbortCopy

func (b *Blob) AbortCopy(copyID string, options *AbortCopyOptions) error

AbortCopy aborts a BlobCopy which has already been triggered by the StartBlobCopy function. copyID is generated from StartBlobCopy function. currentLeaseID is required IF the destination blob has an active lease on it. See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Abort-Copy-Blob

func (*Blob) AcquireLease

func (b *Blob) AcquireLease(leaseTimeInSeconds int, proposedLeaseID string, options *LeaseOptions) (returnedLeaseID string, err error)

AcquireLease creates a lease for a blob returns leaseID acquired In API Versions starting on 2012-02-12, the minimum leaseTimeInSeconds is 15, the maximum non-infinite leaseTimeInSeconds is 60. To specify an infinite lease, provide the value -1. See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob

func (*Blob) AppendBlock

func (b *Blob) AppendBlock(chunk []byte, options *AppendBlockOptions) error

AppendBlock appends a block to an append blob.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Append-Block

func (*Blob) BreakLease

func (b *Blob) BreakLease(options *LeaseOptions) (breakTimeout int, err error)

BreakLease breaks the lease for a blob Returns the timeout remaining in the lease in seconds See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob

func (*Blob) BreakLeaseWithBreakPeriod

func (b *Blob) BreakLeaseWithBreakPeriod(breakPeriodInSeconds int, options *LeaseOptions) (breakTimeout int, err error)

BreakLeaseWithBreakPeriod breaks the lease for a blob breakPeriodInSeconds is used to determine how long until new lease can be created. Returns the timeout remaining in the lease in seconds See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob

func (*Blob) ChangeLease

func (b *Blob) ChangeLease(currentLeaseID string, proposedLeaseID string, options *LeaseOptions) (newLeaseID string, err error)

ChangeLease changes a lease ID for a blob Returns the new LeaseID acquired See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob

func (*Blob) ClearRange

func (b *Blob) ClearRange(blobRange BlobRange, options *PutPageOptions) error

ClearRange clears the given range in a page blob. Ranges must be aligned with 512-byte boundaries and chunk must be of size multiplies by 512.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Page

func (*Blob) Copy

func (b *Blob) Copy(sourceBlob string, options *CopyOptions) error

Copy starts a blob copy operation and waits for the operation to complete. sourceBlob parameter must be a canonical URL to the blob (can be obtained using the GetURL method.) There is no SLA on blob copy and therefore this helper method works faster on smaller files.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Copy-Blob

func (*Blob) CreateBlockBlob

func (b *Blob) CreateBlockBlob(options *PutBlobOptions) error

CreateBlockBlob initializes an empty block blob with no blocks.

See CreateBlockBlobFromReader for more info on creating blobs.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob

func (*Blob) CreateBlockBlobFromReader

func (b *Blob) CreateBlockBlobFromReader(blob io.Reader, options *PutBlobOptions) error

CreateBlockBlobFromReader initializes a block blob using data from reader. Size must be the number of bytes read from reader. To create an empty blob, use size==0 and reader==nil.

Any headers set in blob.Properties or metadata in blob.Metadata will be set on the blob.

The API rejects requests with size > 256 MiB (but this limit is not checked by the SDK). To write a larger blob, use CreateBlockBlob, PutBlock, and PutBlockList.

To create a blob from scratch, call container.GetBlobReference() to get an empty blob, fill in blob.Properties and blob.Metadata as appropriate then call this method.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob

func (*Blob) CreateSnapshot

func (b *Blob) CreateSnapshot(options *SnapshotOptions) (snapshotTimestamp *time.Time, err error)

CreateSnapshot creates a snapshot for a blob See https://msdn.microsoft.com/en-us/library/azure/ee691971.aspx

func (*Blob) Delete

func (b *Blob) Delete(options *DeleteBlobOptions) error

Delete deletes the given blob from the specified container. If the blob does not exists at the time of the Delete Blob operation, it returns error. See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Blob

func (*Blob) DeleteIfExists

func (b *Blob) DeleteIfExists(options *DeleteBlobOptions) (bool, error)

DeleteIfExists deletes the given blob from the specified container If the blob is deleted with this call, returns true. Otherwise returns false.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Blob

func (*Blob) Exists

func (b *Blob) Exists() (bool, error)

Exists returns true if a blob with given name exists on the specified container of the storage account.

func (*Blob) Get

func (b *Blob) Get(options *GetBlobOptions) (io.ReadCloser, error)

Get returns a stream to read the blob. Caller must call both Read and Close() to correctly close the underlying connection.

See the GetRange method for use with a Range header.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Blob

func (*Blob) GetBlockList

func (b *Blob) GetBlockList(blockType BlockListType, options *GetBlockListOptions) (BlockListResponse, error)

GetBlockList retrieves list of blocks in the specified block blob.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Block-List

func (*Blob) GetMetadata

func (b *Blob) GetMetadata(options *GetBlobMetadataOptions) error

GetMetadata returns all user-defined metadata for the specified blob.

All metadata keys will be returned in lower case. (HTTP header names are case-insensitive.)

See https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx

func (*Blob) GetPageRanges

func (b *Blob) GetPageRanges(options *GetPageRangesOptions) (GetPageRangesResponse, error)

GetPageRanges returns the list of valid page ranges for a page blob.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Page-Ranges

func (*Blob) GetProperties

func (b *Blob) GetProperties(options *GetBlobPropertiesOptions) error

GetProperties provides various information about the specified blob. See https://msdn.microsoft.com/en-us/library/azure/dd179394.aspx

func (*Blob) GetRange

func (b *Blob) GetRange(options *GetBlobRangeOptions) (io.ReadCloser, error)

GetRange reads the specified range of a blob to a stream. The bytesRange string must be in a format like "0-", "10-100" as defined in HTTP 1.1 spec. Caller must call both Read and Close()// to correctly close the underlying connection. See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Blob

func (*Blob) GetSASURI

func (b *Blob) GetSASURI(options BlobSASOptions) (string, error)

GetSASURI creates an URL to the blob which contains the Shared Access Signature with the specified options.

See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

func (*Blob) GetURL

func (b *Blob) GetURL() string

GetURL gets the canonical URL to the blob with the specified name in the specified container. This method does not create a publicly accessible URL if the blob or container is private and this method does not check if the blob exists.

func (*Blob) IncrementalCopyBlob

func (b *Blob) IncrementalCopyBlob(sourceBlobURL string, snapshotTime time.Time, options *IncrementalCopyOptions) (string, error)

IncrementalCopyBlob copies a snapshot of a source blob and copies to referring blob sourceBlob parameter must be a valid snapshot URL of the original blob. THe original blob mut be public, or use a Shared Access Signature.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/incremental-copy-blob .

func (*Blob) PutAppendBlob

func (b *Blob) PutAppendBlob(options *PutBlobOptions) error

PutAppendBlob initializes an empty append blob with specified name. An append blob must be created using this method before appending blocks.

See CreateBlockBlobFromReader for more info on creating blobs.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob

func (*Blob) PutBlock

func (b *Blob) PutBlock(blockID string, chunk []byte, options *PutBlockOptions) error

PutBlock saves the given data chunk to the specified block blob with given ID.

The API rejects chunks larger than 100 MiB (but this limit is not checked by the SDK).

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Block

func (*Blob) PutBlockList

func (b *Blob) PutBlockList(blocks []Block, options *PutBlockListOptions) error

PutBlockList saves list of blocks to the specified block blob.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Block-List

func (*Blob) PutBlockWithLength

func (b *Blob) PutBlockWithLength(blockID string, size uint64, blob io.Reader, options *PutBlockOptions) error

PutBlockWithLength saves the given data stream of exactly specified size to the block blob with given ID. It is an alternative to PutBlocks where data comes as stream but the length is known in advance.

The API rejects requests with size > 100 MiB (but this limit is not checked by the SDK).

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Block

func (*Blob) PutPageBlob

func (b *Blob) PutPageBlob(options *PutBlobOptions) error

PutPageBlob initializes an empty page blob with specified name and maximum size in bytes (size must be aligned to a 512-byte boundary). A page blob must be created using this method before writing pages.

See CreateBlockBlobFromReader for more info on creating blobs.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob

func (*Blob) ReleaseLease

func (b *Blob) ReleaseLease(currentLeaseID string, options *LeaseOptions) error

ReleaseLease releases the lease for a blob See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob

func (*Blob) RenewLease

func (b *Blob) RenewLease(currentLeaseID string, options *LeaseOptions) error

RenewLease renews the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx

func (*Blob) SetMetadata

func (b *Blob) SetMetadata(options *SetBlobMetadataOptions) error

SetMetadata replaces the metadata for the specified blob.

Some keys may be converted to Camel-Case before sending. All keys are returned in lower case by GetBlobMetadata. HTTP header names are case-insensitive so case munging should not matter to other applications either.

See https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx

func (*Blob) SetProperties

func (b *Blob) SetProperties(options *SetBlobPropertiesOptions) error

SetProperties replaces the BlobHeaders for the specified blob.

Some keys may be converted to Camel-Case before sending. All keys are returned in lower case by GetBlobProperties. HTTP header names are case-insensitive so case munging should not matter to other applications either.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Blob-Properties

func (*Blob) StartCopy

func (b *Blob) StartCopy(sourceBlob string, options *CopyOptions) (string, error)

StartCopy starts a blob copy operation. sourceBlob parameter must be a canonical URL to the blob (can be obtained using the GetURL method.)

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Copy-Blob

func (*Blob) WaitForCopy

func (b *Blob) WaitForCopy(copyID string) error

WaitForCopy loops until a BlobCopy operation is completed (or fails with error)

func (*Blob) WriteRange

func (b *Blob) WriteRange(blobRange BlobRange, bytes io.Reader, options *PutPageOptions) error

WriteRange writes a range of pages to a page blob. Ranges must be aligned with 512-byte boundaries and chunk must be of size multiplies by 512.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Page

type BlobListResponse

type BlobListResponse struct {
	XMLName    xml.Name `xml:"EnumerationResults"`
	Xmlns      string   `xml:"xmlns,attr"`
	Prefix     string   `xml:"Prefix"`
	Marker     string   `xml:"Marker"`
	NextMarker string   `xml:"NextMarker"`
	MaxResults int64    `xml:"MaxResults"`
	Blobs      []Blob   `xml:"Blobs>Blob"`

	// BlobPrefix is used to traverse blobs as if it were a file system.
	// It is returned if ListBlobsParameters.Delimiter is specified.
	// The list here can be thought of as "folders" that may contain
	// other folders or blobs.
	BlobPrefixes []string `xml:"Blobs>BlobPrefix>Name"`

	// Delimiter is used to traverse blobs as if it were a file system.
	// It is returned if ListBlobsParameters.Delimiter is specified.
	Delimiter string `xml:"Delimiter"`
}

BlobListResponse contains the response fields from ListBlobs call.

See https://msdn.microsoft.com/en-us/library/azure/dd135734.aspx

type BlobMetadata

type BlobMetadata map[string]string

BlobMetadata is a set of custom name/value pairs.

See https://msdn.microsoft.com/en-us/library/azure/dd179404.aspx

func (BlobMetadata) MarshalXML

func (bm BlobMetadata) MarshalXML(enc *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface. It encodes metadata name/value pairs as they would appear in an Azure ListBlobs response.

func (*BlobMetadata) UnmarshalXML

func (bm *BlobMetadata) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML converts the xml:Metadata into Metadata map

type BlobProperties

type BlobProperties struct {
	LastModified          TimeRFC1123 `xml:"Last-Modified"`
	Etag                  string      `xml:"Etag"`
	ContentMD5            string      `xml:"Content-MD5" header:"x-ms-blob-content-md5"`
	ContentLength         int64       `xml:"Content-Length"`
	ContentType           string      `xml:"Content-Type" header:"x-ms-blob-content-type"`
	ContentEncoding       string      `xml:"Content-Encoding" header:"x-ms-blob-content-encoding"`
	CacheControl          string      `xml:"Cache-Control" header:"x-ms-blob-cache-control"`
	ContentLanguage       string      `xml:"Cache-Language" header:"x-ms-blob-content-language"`
	ContentDisposition    string      `xml:"Content-Disposition" header:"x-ms-blob-content-disposition"`
	BlobType              BlobType    `xml:"BlobType"`
	SequenceNumber        int64       `xml:"x-ms-blob-sequence-number"`
	CopyID                string      `xml:"CopyId"`
	CopyStatus            string      `xml:"CopyStatus"`
	CopySource            string      `xml:"CopySource"`
	CopyProgress          string      `xml:"CopyProgress"`
	CopyCompletionTime    TimeRFC1123 `xml:"CopyCompletionTime"`
	CopyStatusDescription string      `xml:"CopyStatusDescription"`
	LeaseStatus           string      `xml:"LeaseStatus"`
	LeaseState            string      `xml:"LeaseState"`
	LeaseDuration         string      `xml:"LeaseDuration"`
	ServerEncrypted       bool        `xml:"ServerEncrypted"`
	IncrementalCopy       bool        `xml:"IncrementalCopy"`
}

BlobProperties contains various properties of a blob returned in various endpoints like ListBlobs or GetBlobProperties.

type BlobRange

type BlobRange struct {
	Start uint64
	End   uint64
}

BlobRange represents the bytes range to be get

func (BlobRange) String

func (br BlobRange) String() string

type BlobSASOptions

type BlobSASOptions struct {
	BlobServiceSASPermissions
	OverrideHeaders
	SASOptions
}

BlobSASOptions are options to construct a blob SAS URI. See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

type BlobServiceSASPermissions

type BlobServiceSASPermissions struct {
	Read   bool
	Add    bool
	Create bool
	Write  bool
	Delete bool
}

BlobServiceSASPermissions includes the available permissions for blob service SAS URI.

type BlobStorageClient

type BlobStorageClient struct {
	// contains filtered or unexported fields
}

BlobStorageClient contains operations for Microsoft Azure Blob Storage Service.

func (*BlobStorageClient) GetContainerReference

func (b *BlobStorageClient) GetContainerReference(name string) *Container

GetContainerReference returns a Container object for the specified container name.

func (*BlobStorageClient) GetServiceProperties

func (b *BlobStorageClient) GetServiceProperties() (*ServiceProperties, error)

GetServiceProperties gets the properties of your storage account's blob service. See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-blob-service-properties

func (BlobStorageClient) ListContainers

ListContainers returns the list of containers in a storage account along with pagination token and other response details.

See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx

func (*BlobStorageClient) SetServiceProperties

func (b *BlobStorageClient) SetServiceProperties(props ServiceProperties) error

SetServiceProperties sets the properties of your storage account's blob service. See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-blob-service-properties

type BlobType

type BlobType string

BlobType defines the type of the Azure Blob.

const (
	BlobTypeBlock  BlobType = "BlockBlob"
	BlobTypePage   BlobType = "PageBlob"
	BlobTypeAppend BlobType = "AppendBlob"
)

Types of page blobs

type Block

type Block struct {
	ID     string
	Status BlockStatus
}

Block is used to create Block entities for Put Block List call.

type BlockListResponse

type BlockListResponse struct {
	XMLName           xml.Name        `xml:"BlockList"`
	CommittedBlocks   []BlockResponse `xml:"CommittedBlocks>Block"`
	UncommittedBlocks []BlockResponse `xml:"UncommittedBlocks>Block"`
}

BlockListResponse contains the response fields from Get Block List call.

See https://msdn.microsoft.com/en-us/library/azure/dd179400.aspx

type BlockListType

type BlockListType string

BlockListType is used to filter out types of blocks in a Get Blocks List call for a block blob.

See https://msdn.microsoft.com/en-us/library/azure/dd179400.aspx for all block types.

const (
	BlockListTypeAll         BlockListType = "all"
	BlockListTypeCommitted   BlockListType = "committed"
	BlockListTypeUncommitted BlockListType = "uncommitted"
)

Filters for listing blocks in block blobs

type BlockResponse

type BlockResponse struct {
	Name string `xml:"Name"`
	Size int64  `xml:"Size"`
}

BlockResponse contains the block information returned in the GetBlockListCall.

type BlockStatus

type BlockStatus string

BlockStatus defines states a block for a block blob can be in.

const (
	BlockStatusUncommitted BlockStatus = "Uncommitted"
	BlockStatusCommitted   BlockStatus = "Committed"
	BlockStatusLatest      BlockStatus = "Latest"
)

List of statuses that can be used to refer to a block in a block list

type Client

type Client struct {
	// HTTPClient is the http.Client used to initiate API
	// requests. http.DefaultClient is used when creating a
	// client.
	HTTPClient *http.Client

	// Sender is an interface that sends the request. Clients are
	// created with a DefaultSender. The DefaultSender has an
	// automatic retry strategy built in. The Sender can be customized.
	Sender Sender

	UseSharedKeyLite bool
	// contains filtered or unexported fields
}

Client is the object that needs to be constructed to perform operations on the storage account.

func NewAccountSASClient

func NewAccountSASClient(account string, token url.Values, env azure.Environment) Client

NewAccountSASClient contructs a client that uses accountSAS authorization for its operations.

func NewAccountSASClientFromEndpointToken

func NewAccountSASClientFromEndpointToken(endpoint string, sasToken string) (Client, error)

NewAccountSASClientFromEndpointToken constructs a client that uses accountSAS authorization for its operations using the specified endpoint and SAS token.

func NewBasicClient

func NewBasicClient(accountName, accountKey string) (Client, error)

NewBasicClient constructs a Client with given storage service name and key.

func NewBasicClientOnSovereignCloud

func NewBasicClientOnSovereignCloud(accountName, accountKey string, env azure.Environment) (Client, error)

NewBasicClientOnSovereignCloud constructs a Client with given storage service name and key in the referenced cloud.

func NewClient

func NewClient(accountName, accountKey, serviceBaseURL, apiVersion string, useHTTPS bool) (Client, error)

NewClient constructs a Client. This should be used if the caller wants to specify whether to use HTTPS, a specific REST API version or a custom storage endpoint than Azure Public Cloud.

func NewClientFromConnectionString

func NewClientFromConnectionString(input string) (Client, error)

NewClientFromConnectionString creates a Client from the connection string.

func NewEmulatorClient

func NewEmulatorClient() (Client, error)

NewEmulatorClient contructs a Client intended to only work with Azure Storage Emulator

func (*Client) AddToUserAgent

func (c *Client) AddToUserAgent(extension string) error

AddToUserAgent adds an extension to the current user agent

func (Client) GetAccountSASToken

func (c Client) GetAccountSASToken(options AccountSASTokenOptions) (url.Values, error)

GetAccountSASToken creates an account SAS token See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas

func (Client) GetBlobService

func (c Client) GetBlobService() BlobStorageClient

GetBlobService returns a BlobStorageClient which can operate on the blob service of the storage account.

func (Client) GetFileService

func (c Client) GetFileService() FileServiceClient

GetFileService returns a FileServiceClient which can operate on the file service of the storage account.

func (Client) GetQueueService

func (c Client) GetQueueService() QueueServiceClient

GetQueueService returns a QueueServiceClient which can operate on the queue service of the storage account.

func (Client) GetTableService

func (c Client) GetTableService() TableServiceClient

GetTableService returns a TableServiceClient which can operate on the table service of the storage account.

type Container

type Container struct {
	Name       string              `xml:"Name"`
	Properties ContainerProperties `xml:"Properties"`
	Metadata   map[string]string
	// contains filtered or unexported fields
}

Container represents an Azure container.

func GetContainerReferenceFromSASURI

func GetContainerReferenceFromSASURI(sasuri url.URL) (*Container, error)

GetContainerReferenceFromSASURI returns a Container object for the specified container SASURI

func (*Container) Client

func (c *Container) Client() *Client

Client returns the HTTP client used by the Container reference.

func (*Container) Create

func (c *Container) Create(options *CreateContainerOptions) error

Create creates a blob container within the storage account with given name and access level. Returns error if container already exists.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Container

func (*Container) CreateIfNotExists

func (c *Container) CreateIfNotExists(options *CreateContainerOptions) (bool, error)

CreateIfNotExists creates a blob container if it does not exist. Returns true if container is newly created or false if container already exists.

func (*Container) Delete

func (c *Container) Delete(options *DeleteContainerOptions) error

Delete deletes the container with given name on the storage account. If the container does not exist returns error.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-container

func (*Container) DeleteIfExists

func (c *Container) DeleteIfExists(options *DeleteContainerOptions) (bool, error)

DeleteIfExists deletes the container with given name on the storage account if it exists. Returns true if container is deleted with this call, or false if the container did not exist at the time of the Delete Container operation.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-container

func (*Container) Exists

func (c *Container) Exists() (bool, error)

Exists returns true if a container with given name exists on the storage account, otherwise returns false.

func (*Container) GetBlobReference

func (c *Container) GetBlobReference(name string) *Blob

GetBlobReference returns a Blob object for the specified blob name.

func (*Container) GetMetadata

func (c *Container) GetMetadata(options *ContainerMetadataOptions) error

GetMetadata returns all user-defined metadata for the specified container.

All metadata keys will be returned in lower case. (HTTP header names are case-insensitive.)

See https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-metadata

func (*Container) GetPermissions

func (c *Container) GetPermissions(options *GetContainerPermissionOptions) (*ContainerPermissions, error)

GetPermissions gets the container permissions as per https://msdn.microsoft.com/en-us/library/azure/dd179469.aspx If timeout is 0 then it will not be passed to Azure leaseID will only be passed to Azure if populated

func (*Container) GetProperties

func (c *Container) GetProperties() error

GetProperties updated the properties of the container.

See https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-properties

func (*Container) GetSASURI

func (c *Container) GetSASURI(options ContainerSASOptions) (string, error)

GetSASURI creates an URL to the container which contains the Shared Access Signature with the specified options.

See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

func (*Container) GetURL

func (c *Container) GetURL() string

GetURL gets the canonical URL to the container. This method does not create a publicly accessible URL if the container is private and this method does not check if the blob exists.

func (*Container) ListBlobs

func (c *Container) ListBlobs(params ListBlobsParameters) (BlobListResponse, error)

ListBlobs returns an object that contains list of blobs in the container, pagination token and other information in the response of List Blobs call.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Blobs

func (*Container) SetMetadata

func (c *Container) SetMetadata(options *ContainerMetadataOptions) error

SetMetadata replaces the metadata for the specified container.

Some keys may be converted to Camel-Case before sending. All keys are returned in lower case by GetBlobMetadata. HTTP header names are case-insensitive so case munging should not matter to other applications either.

See https://docs.microsoft.com/en-us/rest/api/storageservices/set-container-metadata

func (*Container) SetPermissions

func (c *Container) SetPermissions(permissions ContainerPermissions, options *SetContainerPermissionOptions) error

SetPermissions sets up container permissions See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Container-ACL

type ContainerAccessPolicy

type ContainerAccessPolicy struct {
	ID         string
	StartTime  time.Time
	ExpiryTime time.Time
	CanRead    bool
	CanWrite   bool
	CanDelete  bool
}

ContainerAccessPolicy represents each access policy in the container ACL.

type ContainerAccessType

type ContainerAccessType string

ContainerAccessType defines the access level to the container from a public request.

See https://msdn.microsoft.com/en-us/library/azure/dd179468.aspx and "x-ms- blob-public-access" header.

const (
	ContainerAccessTypePrivate   ContainerAccessType = ""
	ContainerAccessTypeBlob      ContainerAccessType = "blob"
	ContainerAccessTypeContainer ContainerAccessType = "container"
)

Access options for containers

type ContainerListResponse

type ContainerListResponse struct {
	XMLName    xml.Name    `xml:"EnumerationResults"`
	Xmlns      string      `xml:"xmlns,attr"`
	Prefix     string      `xml:"Prefix"`
	Marker     string      `xml:"Marker"`
	NextMarker string      `xml:"NextMarker"`
	MaxResults int64       `xml:"MaxResults"`
	Containers []Container `xml:"Containers>Container"`
}

ContainerListResponse contains the response fields from ListContainers call.

See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx

type ContainerMetadataOptions

type ContainerMetadataOptions struct {
	Timeout   uint
	LeaseID   string `header:"x-ms-lease-id"`
	RequestID string `header:"x-ms-client-request-id"`
}

ContainerMetadataOptions includes options for container metadata operations

type ContainerPermissions

type ContainerPermissions struct {
	AccessType     ContainerAccessType
	AccessPolicies []ContainerAccessPolicy
}

ContainerPermissions represents the container ACLs.

type ContainerProperties

type ContainerProperties struct {
	LastModified  string              `xml:"Last-Modified"`
	Etag          string              `xml:"Etag"`
	LeaseStatus   string              `xml:"LeaseStatus"`
	LeaseState    string              `xml:"LeaseState"`
	LeaseDuration string              `xml:"LeaseDuration"`
	PublicAccess  ContainerAccessType `xml:"PublicAccess"`
}

ContainerProperties contains various properties of a container returned from various endpoints like ListContainers.

type ContainerSASOptions

type ContainerSASOptions struct {
	ContainerSASPermissions
	OverrideHeaders
	SASOptions
}

ContainerSASOptions are options to construct a container SAS URI. See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

type ContainerSASPermissions

type ContainerSASPermissions struct {
	BlobServiceSASPermissions
	List bool
}

ContainerSASPermissions includes the available permissions for a container SAS URI.

type CopyOptions

type CopyOptions struct {
	Timeout   uint
	Source    CopyOptionsConditions
	Destiny   CopyOptionsConditions
	RequestID string
}

CopyOptions includes the options for a copy blob operation

type CopyOptionsConditions

type CopyOptionsConditions struct {
	LeaseID           string
	IfModifiedSince   *time.Time
	IfUnmodifiedSince *time.Time
	IfMatch           string
	IfNoneMatch       string
}

CopyOptionsConditions includes some conditional options in a copy blob operation

type Cors

type Cors struct {
	CorsRule []CorsRule
}

Cors includes all the CORS rules

type CorsRule

type CorsRule struct {
	AllowedOrigins  string
	AllowedMethods  string
	MaxAgeInSeconds int
	ExposedHeaders  string
	AllowedHeaders  string
}

CorsRule includes all settings for a Cors rule

type CreateContainerOptions

type CreateContainerOptions struct {
	Timeout   uint
	Access    ContainerAccessType `header:"x-ms-blob-public-access"`
	RequestID string              `header:"x-ms-client-request-id"`
}

CreateContainerOptions includes the options for a create container operation

type DefaultSender

type DefaultSender struct {
	RetryAttempts    int
	RetryDuration    time.Duration
	ValidStatusCodes []int
	// contains filtered or unexported fields
}

DefaultSender is the default sender for the client. It implements an automatic retry strategy.

func (*DefaultSender) Send

func (ds *DefaultSender) Send(c *Client, req *http.Request) (resp *http.Response, err error)

Send is the default retry strategy in the client

type DeleteBlobOptions

type DeleteBlobOptions struct {
	Timeout           uint
	Snapshot          *time.Time
	LeaseID           string `header:"x-ms-lease-id"`
	DeleteSnapshots   *bool
	IfModifiedSince   *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
	IfMatch           string     `header:"If-Match"`
	IfNoneMatch       string     `header:"If-None-Match"`
	RequestID         string     `header:"x-ms-client-request-id"`
}

DeleteBlobOptions includes the options for a delete blob operation

type DeleteContainerOptions

type DeleteContainerOptions struct {
	Timeout           uint
	LeaseID           string     `header:"x-ms-lease-id"`
	IfModifiedSince   *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
	RequestID         string     `header:"x-ms-client-request-id"`
}

DeleteContainerOptions includes options for a delete container operation

type Directory

type Directory struct {
	Metadata map[string]string
	Name     string `xml:"Name"`

	Properties DirectoryProperties
	// contains filtered or unexported fields
}

Directory represents a directory on a share.

func (*Directory) Create

func (d *Directory) Create(options *FileRequestOptions) error

Create this directory in the associated share. If a directory with the same name already exists, the operation fails.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Directory

func (*Directory) CreateIfNotExists

func (d *Directory) CreateIfNotExists(options *FileRequestOptions) (bool, error)

CreateIfNotExists creates this directory under the associated share if the directory does not exists. Returns true if the directory is newly created or false if the directory already exists.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Directory

func (*Directory) Delete

func (d *Directory) Delete(options *FileRequestOptions) error

Delete removes this directory. It must be empty in order to be deleted. If the directory does not exist the operation fails.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Directory

func (*Directory) DeleteIfExists

func (d *Directory) DeleteIfExists(options *FileRequestOptions) (bool, error)

DeleteIfExists removes this directory if it exists.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Directory

func (*Directory) Exists

func (d *Directory) Exists() (bool, error)

Exists returns true if this directory exists.

func (*Directory) FetchAttributes

func (d *Directory) FetchAttributes(options *FileRequestOptions) error

FetchAttributes retrieves metadata for this directory.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-directory-properties

func (*Directory) GetDirectoryReference

func (d *Directory) GetDirectoryReference(name string) *Directory

GetDirectoryReference returns a child Directory object for this directory.

func (*Directory) GetFileReference

func (d *Directory) GetFileReference(name string) *File

GetFileReference returns a child File object for this directory.

func (*Directory) ListDirsAndFiles

func (d *Directory) ListDirsAndFiles(params ListDirsAndFilesParameters) (*DirsAndFilesListResponse, error)

ListDirsAndFiles returns a list of files and directories under this directory. It also contains a pagination token and other response details.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Directories-and-Files

func (*Directory) SetMetadata

func (d *Directory) SetMetadata(options *FileRequestOptions) error

SetMetadata replaces the metadata for this directory.

Some keys may be converted to Camel-Case before sending. All keys are returned in lower case by GetDirectoryMetadata. HTTP header names are case-insensitive so case munging should not matter to other applications either.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Directory-Metadata

func (*Directory) URL

func (d *Directory) URL() string

URL gets the canonical URL to this directory. This method does not create a publicly accessible URL if the directory is private and this method does not check if the directory exists.

type DirectoryProperties

type DirectoryProperties struct {
	LastModified string `xml:"Last-Modified"`
	Etag         string `xml:"Etag"`
}

DirectoryProperties contains various properties of a directory.

type DirsAndFilesListResponse

type DirsAndFilesListResponse struct {
	XMLName     xml.Name    `xml:"EnumerationResults"`
	Xmlns       string      `xml:"xmlns,attr"`
	Marker      string      `xml:"Marker"`
	MaxResults  int64       `xml:"MaxResults"`
	Directories []Directory `xml:"Entries>Directory"`
	Files       []File      `xml:"Entries>File"`
	NextMarker  string      `xml:"NextMarker"`
}

DirsAndFilesListResponse contains the response fields from a List Files and Directories call.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Directories-and-Files

type Entity

type Entity struct {
	Table         *Table
	PartitionKey  string
	RowKey        string
	TimeStamp     time.Time
	OdataMetadata string
	OdataType     string
	OdataID       string
	OdataEtag     string
	OdataEditLink string
	Properties    map[string]interface{}
}

Entity represents an entity inside an Azure table.

func (*Entity) Delete

func (e *Entity) Delete(force bool, options *EntityOptions) error

Delete deletes the entity. The function fails if there is no entity with the same PartitionKey and RowKey in the table or if the ETag is different than the one in Azure. See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-entity1

func (*Entity) Get

func (e *Entity) Get(timeout uint, ml MetadataLevel, options *GetEntityOptions) error

Get gets the referenced entity. Which properties to get can be specified using the select option. See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-entities https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/querying-tables-and-entities

func (*Entity) Insert

func (e *Entity) Insert(ml MetadataLevel, options *EntityOptions) error

Insert inserts the referenced entity in its table. The function fails if there is an entity with the same PartitionKey and RowKey in the table. ml determines the level of detail of metadata in the operation response, or no data at all. See: https://docs.microsoft.com/rest/api/storageservices/fileservices/insert-entity

func (*Entity) InsertOrMerge

func (e *Entity) InsertOrMerge(options *EntityOptions) error

InsertOrMerge inserts an entity or merges the existing one. Read more: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/insert-or-merge-entity

func (*Entity) InsertOrReplace

func (e *Entity) InsertOrReplace(options *EntityOptions) error

InsertOrReplace inserts an entity or replaces the existing one. Read more: https://docs.microsoft.com/rest/api/storageservices/fileservices/insert-or-replace-entity

func (*Entity) MarshalJSON

func (e *Entity) MarshalJSON() ([]byte, error)

MarshalJSON is a custom marshaller for entity

func (*Entity) Merge

func (e *Entity) Merge(force bool, options *EntityOptions) error

Merge merges the contents of entity specified with PartitionKey and RowKey with the content specified in Properties. The function fails if there is no entity with the same PartitionKey and RowKey in the table or if the ETag is different than the one in Azure. Read more: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/merge-entity

func (*Entity) UnmarshalJSON

func (e *Entity) UnmarshalJSON(data []byte) error

UnmarshalJSON is a custom unmarshaller for entities

func (*Entity) Update

func (e *Entity) Update(force bool, options *EntityOptions) error

Update updates the contents of an entity. The function fails if there is no entity with the same PartitionKey and RowKey in the table or if the ETag is different than the one in Azure. See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/update-entity2

type EntityOptions

type EntityOptions struct {
	Timeout   uint
	RequestID string `header:"x-ms-client-request-id"`
}

EntityOptions includes options for entity operations.

type EntityQueryResult

type EntityQueryResult struct {
	OdataMetadata string    `json:"odata.metadata"`
	Entities      []*Entity `json:"value"`
	QueryNextLink
	// contains filtered or unexported fields
}

EntityQueryResult contains the response from ExecuteQuery and ExecuteQueryNextResults functions.

func (*EntityQueryResult) NextResults

func (eqr *EntityQueryResult) NextResults(options *TableOptions) (*EntityQueryResult, error)

NextResults returns the next page of results from a QueryEntities or NextResults operation.

See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-entities See https://docs.microsoft.com/rest/api/storageservices/fileservices/query-timeout-and-pagination

type File

type File struct {
	Metadata map[string]string
	Name     string `xml:"Name"`

	Properties FileProperties `xml:"Properties"`

	FileCopyProperties FileCopyState
	// contains filtered or unexported fields
}

File represents a file on a share.

func (*File) ClearRange

func (f *File) ClearRange(fileRange FileRange, options *FileRequestOptions) error

ClearRange releases the specified range of space in a file.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Range

func (*File) CopyFile

func (f *File) CopyFile(sourceURL string, options *FileRequestOptions) error

CopyFile operation copied a file/blob from the sourceURL to the path provided.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/copy-file

func (*File) Create

func (f *File) Create(maxSize uint64, options *FileRequestOptions) error

Create creates a new file or replaces an existing one.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-File

func (*File) Delete

func (f *File) Delete(options *FileRequestOptions) error

Delete immediately removes this file from the storage account.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-File2

func (*File) DeleteIfExists

func (f *File) DeleteIfExists(options *FileRequestOptions) (bool, error)

DeleteIfExists removes this file if it exists.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-File2

func (*File) DownloadRangeToStream

func (f *File) DownloadRangeToStream(fileRange FileRange, options *GetFileOptions) (fs FileStream, err error)

DownloadRangeToStream operation downloads the specified range of this file with optional MD5 hash.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file

func (*File) DownloadToStream

func (f *File) DownloadToStream(options *FileRequestOptions) (io.ReadCloser, error)

DownloadToStream operation downloads the file.

See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file

func (*File) Exists

func (f *File) Exists() (bool, error)

Exists returns true if this file exists.

func (*File) FetchAttributes

func (f *File) FetchAttributes(options *FileRequestOptions) error

FetchAttributes updates metadata and properties for this file. See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file-properties

func (*File) ListRanges

func (f *File) ListRanges(options *ListRangesOptions) (*FileRanges, error)

ListRanges returns the list of valid ranges for this file.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Ranges

func (*File) SetMetadata

func (f *File) SetMetadata(options *FileRequestOptions) error

SetMetadata replaces the metadata for this file.

Some keys may be converted to Camel-Case before sending. All keys are returned in lower case by GetFileMetadata. HTTP header names are case-insensitive so case munging should not matter to other applications either.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-File-Metadata

func (*File) SetProperties

func (f *File) SetProperties(options *FileRequestOptions) error

SetProperties sets system properties on this file.

Some keys may be converted to Camel-Case before sending. All keys are returned in lower case by SetFileProperties. HTTP header names are case-insensitive so case munging should not matter to other applications either.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-File-Properties

func (*File) URL

func (f *File) URL() string

URL gets the canonical URL to this file. This method does not create a publicly accessible URL if the file is private and this method does not check if the file exists.

func (*File) WriteRange

func (f *File) WriteRange(bytes io.Reader, fileRange FileRange, options *WriteRangeOptions) error

WriteRange writes a range of bytes to this file with an optional MD5 hash of the content (inside options parameter). Note that the length of bytes must match (rangeEnd - rangeStart) + 1 with a maximum size of 4MB.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Range

type FileCopyState

type FileCopyState struct {
	CompletionTime string
	ID             string `header:"x-ms-copy-id"`
	Progress       string
	Source         string
	Status         string `header:"x-ms-copy-status"`
	StatusDesc     string
}

FileCopyState contains various properties of a file copy operation.

type FileProperties

type FileProperties struct {
	CacheControl string `header:"x-ms-cache-control"`
	Disposition  string `header:"x-ms-content-disposition"`
	Encoding     string `header:"x-ms-content-encoding"`
	Etag         string
	Language     string `header:"x-ms-content-language"`
	LastModified string
	Length       uint64 `xml:"Content-Length" header:"x-ms-content-length"`
	MD5          string `header:"x-ms-content-md5"`
	Type         string `header:"x-ms-content-type"`
}

FileProperties contains various properties of a file.

type FileRange

type FileRange struct {
	Start uint64 `xml:"Start"`
	End   uint64 `xml:"End"`
}

FileRange contains range information for a file.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Ranges

func (FileRange) String

func (fr FileRange) String() string

type FileRanges

type FileRanges struct {
	ContentLength uint64
	LastModified  string
	ETag          string
	FileRanges    []FileRange `xml:"Range"`
}

FileRanges contains a list of file range information for a file.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Ranges

type FileRequestOptions

type FileRequestOptions struct {
	Timeout uint // timeout duration in seconds.
}

FileRequestOptions will be passed to misc file operations. Currently just Timeout (in seconds) but could expand.

type FileServiceClient

type FileServiceClient struct {
	// contains filtered or unexported fields
}

FileServiceClient contains operations for Microsoft Azure File Service.

func (*FileServiceClient) GetServiceProperties

func (f *FileServiceClient) GetServiceProperties() (*ServiceProperties, error)

GetServiceProperties gets the properties of your storage account's file service. File service does not support logging See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file-service-properties

func (*FileServiceClient) GetShareReference

func (f *FileServiceClient) GetShareReference(name string) *Share

GetShareReference returns a Share object for the specified share name.

func (FileServiceClient) ListShares

ListShares returns the list of shares in a storage account along with pagination token and other response details.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/list-shares

func (*FileServiceClient) SetServiceProperties

func (f *FileServiceClient) SetServiceProperties(props ServiceProperties) error

SetServiceProperties sets the properties of your storage account's file service. File service does not support logging See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-file-service-properties

type FileStream

type FileStream struct {
	Body       io.ReadCloser
	ContentMD5 string
}

FileStream contains file data returned from a call to GetFile.

type GetBlobMetadataOptions

type GetBlobMetadataOptions struct {
	Timeout           uint
	Snapshot          *time.Time
	LeaseID           string     `header:"x-ms-lease-id"`
	IfModifiedSince   *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
	IfMatch           string     `header:"If-Match"`
	IfNoneMatch       string     `header:"If-None-Match"`
	RequestID         string     `header:"x-ms-client-request-id"`
}

GetBlobMetadataOptions includes the options for a get blob metadata operation

type GetBlobOptions

type GetBlobOptions struct {
	Timeout           uint
	Snapshot          *time.Time
	LeaseID           string     `header:"x-ms-lease-id"`
	Origin            string     `header:"Origin"`
	IfModifiedSince   *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
	IfMatch           string     `header:"If-Match"`
	IfNoneMatch       string     `header:"If-None-Match"`
	RequestID         string     `header:"x-ms-client-request-id"`
}

GetBlobOptions includes the options for a get blob operation

type GetBlobPropertiesOptions

type GetBlobPropertiesOptions struct {
	Timeout           uint
	Snapshot          *time.Time
	LeaseID           string     `header:"x-ms-lease-id"`
	IfModifiedSince   *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
	IfMatch           string     `header:"If-Match"`
	IfNoneMatch       string     `header:"If-None-Match"`
	RequestID         string     `header:"x-ms-client-request-id"`
}

GetBlobPropertiesOptions includes the options for a get blob properties operation

type GetBlobRangeOptions

type GetBlobRangeOptions struct {
	Range              *BlobRange
	GetRangeContentMD5 bool
	*GetBlobOptions
}

GetBlobRangeOptions includes the options for a get blob range operation

type GetBlockListOptions

type GetBlockListOptions struct {
	Timeout   uint
	Snapshot  *time.Time
	LeaseID   string `header:"x-ms-lease-id"`
	RequestID string `header:"x-ms-client-request-id"`
}

GetBlockListOptions includes the options for a get block list operation

type GetContainerPermissionOptions

type GetContainerPermissionOptions struct {
	Timeout   uint
	LeaseID   string `header:"x-ms-lease-id"`
	RequestID string `header:"x-ms-client-request-id"`
}

GetContainerPermissionOptions includes options for a get container permissions operation

type GetEntityOptions

type GetEntityOptions struct {
	Select    []string
	RequestID string `header:"x-ms-client-request-id"`
}

GetEntityOptions includes options for a get entity operation

type GetFileOptions

type GetFileOptions struct {
	Timeout       uint
	GetContentMD5 bool
}

GetFileOptions includes options for a get file operation

type GetMessagesOptions

type GetMessagesOptions struct {
	Timeout           uint
	NumOfMessages     int
	VisibilityTimeout int
	RequestID         string `header:"x-ms-client-request-id"`
}

GetMessagesOptions is the set of options can be specified for Get Messsages operation. A zero struct does not use any preferences for the request.

type GetPageRangesOptions

type GetPageRangesOptions struct {
	Timeout          uint
	Snapshot         *time.Time
	PreviousSnapshot *time.Time
	Range            *BlobRange
	LeaseID          string `header:"x-ms-lease-id"`
	RequestID        string `header:"x-ms-client-request-id"`
}

GetPageRangesOptions includes the options for a get page ranges operation

type GetPageRangesResponse

type GetPageRangesResponse struct {
	XMLName  xml.Name    `xml:"PageList"`
	PageList []PageRange `xml:"PageRange"`
}

GetPageRangesResponse contains the response fields from Get Page Ranges call.

See https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx

type GetQueuePermissionOptions

type GetQueuePermissionOptions struct {
	Timeout   uint
	RequestID string `header:"x-ms-client-request-id"`
}

GetQueuePermissionOptions includes options for a get queue permissions operation

type IncludeBlobDataset

type IncludeBlobDataset struct {
	Snapshots        bool
	Metadata         bool
	UncommittedBlobs bool
	Copy             bool
}

IncludeBlobDataset has options to include in a list blobs operation

type IncrementalCopyOptions

type IncrementalCopyOptions struct {
	Timeout     uint
	Destination IncrementalCopyOptionsConditions
	RequestID   string
}

IncrementalCopyOptions includes the options for an incremental copy blob operation

type IncrementalCopyOptionsConditions

type IncrementalCopyOptionsConditions struct {
	IfModifiedSince   *time.Time
	IfUnmodifiedSince *time.Time
	IfMatch           string
	IfNoneMatch       string
}

IncrementalCopyOptionsConditions includes some conditional options in a copy blob operation

type LeaseOptions

type LeaseOptions struct {
	Timeout           uint
	Origin            string     `header:"Origin"`
	IfMatch           string     `header:"If-Match"`
	IfNoneMatch       string     `header:"If-None-Match"`
	IfModifiedSince   *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
	RequestID         string     `header:"x-ms-client-request-id"`
}

LeaseOptions includes options for all operations regarding leasing blobs

type ListBlobsParameters

type ListBlobsParameters struct {
	Prefix     string
	Delimiter  string
	Marker     string
	Include    *IncludeBlobDataset
	MaxResults uint
	Timeout    uint
	RequestID  string
}

ListBlobsParameters defines the set of customizable parameters to make a List Blobs call.

See https://msdn.microsoft.com/en-us/library/azure/dd135734.aspx

type ListContainersParameters

type ListContainersParameters struct {
	Prefix     string
	Marker     string
	Include    string
	MaxResults uint
	Timeout    uint
}

ListContainersParameters defines the set of customizable parameters to make a List Containers call.

See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx

type ListDirsAndFilesParameters

type ListDirsAndFilesParameters struct {
	Prefix     string
	Marker     string
	MaxResults uint
	Timeout    uint
}

ListDirsAndFilesParameters defines the set of customizable parameters to make a List Files and Directories call.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Directories-and-Files

type ListRangesOptions

type ListRangesOptions struct {
	Timeout   uint
	ListRange *FileRange
}

ListRangesOptions includes options for a list file ranges operation

type ListSharesParameters

type ListSharesParameters struct {
	Prefix     string
	Marker     string
	Include    string
	MaxResults uint
	Timeout    uint
}

ListSharesParameters defines the set of customizable parameters to make a List Shares call.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Shares

type Logging

type Logging struct {
	Version         string
	Delete          bool
	Read            bool
	Write           bool
	RetentionPolicy *RetentionPolicy
}

Logging represents the Azure Analytics Logging settings

type Message

type Message struct {
	Queue        *Queue
	Text         string      `xml:"MessageText"`
	ID           string      `xml:"MessageId"`
	Insertion    TimeRFC1123 `xml:"InsertionTime"`
	Expiration   TimeRFC1123 `xml:"ExpirationTime"`
	PopReceipt   string      `xml:"PopReceipt"`
	NextVisible  TimeRFC1123 `xml:"TimeNextVisible"`
	DequeueCount int         `xml:"DequeueCount"`
}

Message represents an Azure message.

func (*Message) Delete

func (m *Message) Delete(options *QueueServiceOptions) error

Delete operation deletes the specified message.

See https://msdn.microsoft.com/en-us/library/azure/dd179347.aspx

func (*Message) Put

func (m *Message) Put(options *PutMessageOptions) error

Put operation adds a new message to the back of the message queue.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Message

func (*Message) Update

func (m *Message) Update(options *UpdateMessageOptions) error

Update operation updates the specified message.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Update-Message

type MetadataLevel

type MetadataLevel string

MetadataLevel determines if operations should return a paylod, and it level of detail.

type Metrics

type Metrics struct {
	Version         string
	Enabled         bool
	IncludeAPIs     *bool
	RetentionPolicy *RetentionPolicy
}

Metrics provide request statistics.

type Operation

type Operation int

Operation type. Insert, Delete, Replace etc.

type OverrideHeaders

type OverrideHeaders struct {
	CacheControl       string
	ContentDisposition string
	ContentEncoding    string
	ContentLanguage    string
	ContentType        string
}

OverrideHeaders defines overridable response heaedrs in a request using a SAS URI. See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

type PageRange

type PageRange struct {
	Start int64 `xml:"Start"`
	End   int64 `xml:"End"`
}

PageRange contains information about a page of a page blob from Get Pages Range call.

See https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx

type PeekMessagesOptions

type PeekMessagesOptions struct {
	Timeout       uint
	NumOfMessages int
	RequestID     string `header:"x-ms-client-request-id"`
}

PeekMessagesOptions is the set of options can be specified for Peek Messsage operation. A zero struct does not use any preferences for the request.

type Permissions

type Permissions struct {
	Read    bool
	Write   bool
	Delete  bool
	List    bool
	Add     bool
	Create  bool
	Update  bool
	Process bool
}

Permissions specifies permissions for an accountSAS.

type PutBlobOptions

type PutBlobOptions struct {
	Timeout           uint
	LeaseID           string     `header:"x-ms-lease-id"`
	Origin            string     `header:"Origin"`
	IfModifiedSince   *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
	IfMatch           string     `header:"If-Match"`
	IfNoneMatch       string     `header:"If-None-Match"`
	RequestID         string     `header:"x-ms-client-request-id"`
}

PutBlobOptions includes the options any put blob operation (page, block, append)

type PutBlockListOptions

type PutBlockListOptions struct {
	Timeout           uint
	LeaseID           string     `header:"x-ms-lease-id"`
	IfModifiedSince   *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
	IfMatch           string     `header:"If-Match"`
	IfNoneMatch       string     `header:"If-None-Match"`
	RequestID         string     `header:"x-ms-client-request-id"`
}

PutBlockListOptions includes the options for a put block list operation

type PutBlockOptions

type PutBlockOptions struct {
	Timeout    uint
	LeaseID    string `header:"x-ms-lease-id"`
	ContentMD5 string `header:"Content-MD5"`
	RequestID  string `header:"x-ms-client-request-id"`
}

PutBlockOptions includes the options for a put block operation

type PutMessageOptions

type PutMessageOptions struct {
	Timeout           uint
	VisibilityTimeout int
	MessageTTL        int
	RequestID         string `header:"x-ms-client-request-id"`
}

PutMessageOptions is the set of options can be specified for Put Messsage operation. A zero struct does not use any preferences for the request.

type PutPageOptions

type PutPageOptions struct {
	Timeout                           uint
	LeaseID                           string     `header:"x-ms-lease-id"`
	IfSequenceNumberLessThanOrEqualTo *int       `header:"x-ms-if-sequence-number-le"`
	IfSequenceNumberLessThan          *int       `header:"x-ms-if-sequence-number-lt"`
	IfSequenceNumberEqualTo           *int       `header:"x-ms-if-sequence-number-eq"`
	IfModifiedSince                   *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince                 *time.Time `header:"If-Unmodified-Since"`
	IfMatch                           string     `header:"If-Match"`
	IfNoneMatch                       string     `header:"If-None-Match"`
	RequestID                         string     `header:"x-ms-client-request-id"`
}

PutPageOptions includes the options for a put page operation

type QueryNextLink struct {
	NextLink *string
	// contains filtered or unexported fields
}

QueryNextLink includes information for getting the next page of results in query operations

type QueryOptions

type QueryOptions struct {
	Top       uint
	Filter    string
	Select    []string
	RequestID string
}

QueryOptions includes options for a query entities operation. Top, filter and select are OData query options.

type QueryTablesOptions

type QueryTablesOptions struct {
	Top       uint
	Filter    string
	RequestID string
}

QueryTablesOptions includes options for some table operations

type Queue

type Queue struct {
	Name              string
	Metadata          map[string]string
	AproxMessageCount uint64
	// contains filtered or unexported fields
}

Queue represents an Azure queue.

func (*Queue) ClearMessages

func (q *Queue) ClearMessages(options *QueueServiceOptions) error

ClearMessages operation deletes all messages from the specified queue.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Clear-Messages

func (*Queue) Create

func (q *Queue) Create(options *QueueServiceOptions) error

Create operation creates a queue under the given account.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Queue4

func (*Queue) Delete

func (q *Queue) Delete(options *QueueServiceOptions) error

Delete operation permanently deletes the specified queue.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Queue3

func (*Queue) Exists

func (q *Queue) Exists() (bool, error)

Exists returns true if a queue with given name exists.

func (*Queue) GetMessageReference

func (q *Queue) GetMessageReference(text string) *Message

GetMessageReference returns a message object with the specified text.

func (*Queue) GetMessages

func (q *Queue) GetMessages(options *GetMessagesOptions) ([]Message, error)

GetMessages operation retrieves one or more messages from the front of the queue.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Messages

func (*Queue) GetMetadata

func (q *Queue) GetMetadata(options *QueueServiceOptions) error

GetMetadata operation retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-values pairs.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Queue-Metadata

Because the way Golang's http client (and http.Header in particular) canonicalize header names, the returned metadata names would always be all lower case.

func (*Queue) GetPermissions

func (q *Queue) GetPermissions(options *GetQueuePermissionOptions) (*QueuePermissions, error)

GetPermissions gets the queue permissions as per https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-queue-acl If timeout is 0 then it will not be passed to Azure

func (*Queue) GetSASURI

func (q *Queue) GetSASURI(options QueueSASOptions) (string, error)

GetSASURI creates an URL to the specified queue which contains the Shared Access Signature with specified permissions and expiration time.

See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

func (*Queue) PeekMessages

func (q *Queue) PeekMessages(options *PeekMessagesOptions) ([]Message, error)

PeekMessages retrieves one or more messages from the front of the queue, but does not alter the visibility of the message.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Peek-Messages

func (*Queue) SetMetadata

func (q *Queue) SetMetadata(options *QueueServiceOptions) error

SetMetadata operation sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Queue-Metadata

func (*Queue) SetPermissions

func (q *Queue) SetPermissions(permissions QueuePermissions, options *SetQueuePermissionOptions) error

SetPermissions sets up queue permissions See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-queue-acl

type QueueAccessPolicy

type QueueAccessPolicy struct {
	ID         string
	StartTime  time.Time
	ExpiryTime time.Time
	CanRead    bool
	CanAdd     bool
	CanUpdate  bool
	CanProcess bool
}

QueueAccessPolicy represents each access policy in the queue ACL.

type QueuePermissions

type QueuePermissions struct {
	AccessPolicies []QueueAccessPolicy
}

QueuePermissions represents the queue ACLs.

type QueueSASOptions

type QueueSASOptions struct {
	QueueSASPermissions
	SASOptions
}

QueueSASOptions are options to construct a blob SAS URI. See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

type QueueSASPermissions

type QueueSASPermissions struct {
	Read    bool
	Add     bool
	Update  bool
	Process bool
}

QueueSASPermissions includes the available permissions for a queue SAS URI.

type QueueServiceClient

type QueueServiceClient struct {
	// contains filtered or unexported fields
}

QueueServiceClient contains operations for Microsoft Azure Queue Storage Service.

func (*QueueServiceClient) GetQueueReference

func (q *QueueServiceClient) GetQueueReference(name string) *Queue

GetQueueReference returns a Container object for the specified queue name.

func (*QueueServiceClient) GetServiceProperties

func (q *QueueServiceClient) GetServiceProperties() (*ServiceProperties, error)

GetServiceProperties gets the properties of your storage account's queue service. See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-queue-service-properties

func (*QueueServiceClient) SetServiceProperties

func (q *QueueServiceClient) SetServiceProperties(props ServiceProperties) error

SetServiceProperties sets the properties of your storage account's queue service. See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-queue-service-properties

type QueueServiceOptions

type QueueServiceOptions struct {
	Timeout   uint
	RequestID string `header:"x-ms-client-request-id"`
}

QueueServiceOptions includes options for some queue service operations

type ResourceTypes

type ResourceTypes struct {
	Service   bool
	Container bool
	Object    bool
}

ResourceTypes specify the resources accesible with an account SAS.

type RetentionPolicy

type RetentionPolicy struct {
	Enabled bool
	Days    *int
}

RetentionPolicy indicates if retention is enabled and for how many days

type SASOptions

type SASOptions struct {
	APIVersion string
	Start      time.Time
	Expiry     time.Time
	IP         string
	UseHTTPS   bool
	Identifier string
}

SASOptions includes options used by SAS URIs for different services and resources.

type Sender

type Sender interface {
	Send(*Client, *http.Request) (*http.Response, error)
}

Sender sends a request

type SequenceNumberAction

type SequenceNumberAction string

SequenceNumberAction defines how the blob's sequence number should be modified

const (
	SequenceNumberActionMax       SequenceNumberAction = "max"
	SequenceNumberActionUpdate    SequenceNumberAction = "update"
	SequenceNumberActionIncrement SequenceNumberAction = "increment"
)

Options for sequence number action

type ServiceProperties

type ServiceProperties struct {
	Logging       *Logging
	HourMetrics   *Metrics
	MinuteMetrics *Metrics
	Cors          *Cors
}

ServiceProperties represents the storage account service properties

type Services

type Services struct {
	Blob  bool
	Queue bool
	Table bool
	File  bool
}

Services specify services accessible with an account SAS.

type SetBlobMetadataOptions

type SetBlobMetadataOptions struct {
	Timeout           uint
	LeaseID           string     `header:"x-ms-lease-id"`
	IfModifiedSince   *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
	IfMatch           string     `header:"If-Match"`
	IfNoneMatch       string     `header:"If-None-Match"`
	RequestID         string     `header:"x-ms-client-request-id"`
}

SetBlobMetadataOptions includes the options for a set blob metadata operation

type SetBlobPropertiesOptions

type SetBlobPropertiesOptions struct {
	Timeout              uint
	LeaseID              string     `header:"x-ms-lease-id"`
	Origin               string     `header:"Origin"`
	IfModifiedSince      *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince    *time.Time `header:"If-Unmodified-Since"`
	IfMatch              string     `header:"If-Match"`
	IfNoneMatch          string     `header:"If-None-Match"`
	SequenceNumberAction *SequenceNumberAction
	RequestID            string `header:"x-ms-client-request-id"`
}

SetBlobPropertiesOptions contains various properties of a blob and is an entry in SetProperties

type SetContainerPermissionOptions

type SetContainerPermissionOptions struct {
	Timeout           uint
	LeaseID           string     `header:"x-ms-lease-id"`
	IfModifiedSince   *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
	RequestID         string     `header:"x-ms-client-request-id"`
}

SetContainerPermissionOptions includes options for a set container permissions operation

type SetQueuePermissionOptions

type SetQueuePermissionOptions struct {
	Timeout   uint
	RequestID string `header:"x-ms-client-request-id"`
}

SetQueuePermissionOptions includes options for a set queue permissions operation

type Share

type Share struct {
	Name       string          `xml:"Name"`
	Properties ShareProperties `xml:"Properties"`
	Metadata   map[string]string
	// contains filtered or unexported fields
}

Share represents an Azure file share.

func (*Share) Create

func (s *Share) Create(options *FileRequestOptions) error

Create this share under the associated account. If a share with the same name already exists, the operation fails.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Share

func (*Share) CreateIfNotExists

func (s *Share) CreateIfNotExists(options *FileRequestOptions) (bool, error)

CreateIfNotExists creates this share under the associated account if it does not exist. Returns true if the share is newly created or false if the share already exists.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Share

func (*Share) Delete

func (s *Share) Delete(options *FileRequestOptions) error

Delete marks this share for deletion. The share along with any files and directories contained within it are later deleted during garbage collection. If the share does not exist the operation fails

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Share

func (*Share) DeleteIfExists

func (s *Share) DeleteIfExists(options *FileRequestOptions) (bool, error)

DeleteIfExists operation marks this share for deletion if it exists.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Share

func (*Share) Exists

func (s *Share) Exists() (bool, error)

Exists returns true if this share already exists on the storage account, otherwise returns false.

func (*Share) FetchAttributes

func (s *Share) FetchAttributes(options *FileRequestOptions) error

FetchAttributes retrieves metadata and properties for this share. See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-share-properties

func (*Share) GetRootDirectoryReference

func (s *Share) GetRootDirectoryReference() *Directory

GetRootDirectoryReference returns a Directory object at the root of this share.

func (*Share) ServiceClient

func (s *Share) ServiceClient() *FileServiceClient

ServiceClient returns the FileServiceClient associated with this share.

func (*Share) SetMetadata

func (s *Share) SetMetadata(options *FileRequestOptions) error

SetMetadata replaces the metadata for this share.

Some keys may be converted to Camel-Case before sending. All keys are returned in lower case by GetShareMetadata. HTTP header names are case-insensitive so case munging should not matter to other applications either.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-share-metadata

func (*Share) SetProperties

func (s *Share) SetProperties(options *FileRequestOptions) error

SetProperties sets system properties for this share.

Some keys may be converted to Camel-Case before sending. All keys are returned in lower case by SetShareProperties. HTTP header names are case-insensitive so case munging should not matter to other applications either.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Share-Properties

func (*Share) URL

func (s *Share) URL() string

URL gets the canonical URL to this share. This method does not create a publicly accessible URL if the share is private and this method does not check if the share exists.

type ShareListResponse

type ShareListResponse struct {
	XMLName    xml.Name `xml:"EnumerationResults"`
	Xmlns      string   `xml:"xmlns,attr"`
	Prefix     string   `xml:"Prefix"`
	Marker     string   `xml:"Marker"`
	NextMarker string   `xml:"NextMarker"`
	MaxResults int64    `xml:"MaxResults"`
	Shares     []Share  `xml:"Shares>Share"`
}

ShareListResponse contains the response fields from ListShares call.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Shares

type ShareProperties

type ShareProperties struct {
	LastModified string `xml:"Last-Modified"`
	Etag         string `xml:"Etag"`
	Quota        int    `xml:"Quota"`
}

ShareProperties contains various properties of a share.

type SignedIdentifier

type SignedIdentifier struct {
	ID           string                 `xml:"Id"`
	AccessPolicy AccessPolicyDetailsXML `xml:"AccessPolicy"`
}

SignedIdentifier is a wrapper for a specific policy

type SignedIdentifiers

type SignedIdentifiers struct {
	SignedIdentifiers []SignedIdentifier `xml:"SignedIdentifier"`
}

SignedIdentifiers part of the response from GetPermissions call.

type SnapshotOptions

type SnapshotOptions struct {
	Timeout           uint
	LeaseID           string     `header:"x-ms-lease-id"`
	IfModifiedSince   *time.Time `header:"If-Modified-Since"`
	IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
	IfMatch           string     `header:"If-Match"`
	IfNoneMatch       string     `header:"If-None-Match"`
	RequestID         string     `header:"x-ms-client-request-id"`
}

SnapshotOptions includes the options for a snapshot blob operation

type Table

type Table struct {
	Name          string `json:"TableName"`
	OdataEditLink string `json:"odata.editLink"`
	OdataID       string `json:"odata.id"`
	OdataMetadata string `json:"odata.metadata"`
	OdataType     string `json:"odata.type"`
	// contains filtered or unexported fields
}

Table represents an Azure table.

func (*Table) Create

func (t *Table) Create(timeout uint, ml MetadataLevel, options *TableOptions) error

Create creates the referenced table. This function fails if the name is not compliant with the specification or the tables already exists. ml determines the level of detail of metadata in the operation response, or no data at all. See https://docs.microsoft.com/rest/api/storageservices/fileservices/create-table

func (*Table) Delete

func (t *Table) Delete(timeout uint, options *TableOptions) error

Delete deletes the referenced table. This function fails if the table is not present. Be advised: Delete deletes all the entries that may be present. See https://docs.microsoft.com/rest/api/storageservices/fileservices/delete-table

func (*Table) GetEntityReference

func (t *Table) GetEntityReference(partitionKey, rowKey string) *Entity

GetEntityReference returns an Entity object with the specified partition key and row key.

func (*Table) GetPermissions

func (t *Table) GetPermissions(timeout int, options *TableOptions) ([]TableAccessPolicy, error)

GetPermissions gets the table ACL permissions See https://docs.microsoft.com/rest/api/storageservices/fileservices/get-table-acl

func (*Table) NewBatch

func (t *Table) NewBatch() *TableBatch

NewBatch return new TableBatch for populating.

func (*Table) QueryEntities

func (t *Table) QueryEntities(timeout uint, ml MetadataLevel, options *QueryOptions) (*EntityQueryResult, error)

QueryEntities returns the entities in the table. You can use query options defined by the OData Protocol specification.

See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-entities

func (*Table) SetPermissions

func (t *Table) SetPermissions(tap []TableAccessPolicy, timeout uint, options *TableOptions) error

SetPermissions sets up table ACL permissions See https://docs.microsoft.com/rest/api/storageservices/fileservices/Set-Table-ACL

type TableAccessPolicy

type TableAccessPolicy struct {
	ID         string
	StartTime  time.Time
	ExpiryTime time.Time
	CanRead    bool
	CanAppend  bool
	CanUpdate  bool
	CanDelete  bool
}

TableAccessPolicy are used for SETTING table policies

type TableBatch

type TableBatch struct {
	BatchEntitySlice []BatchEntity

	// reference to table we're operating on.
	Table *Table
}

TableBatch stores all the entities that will be operated on during a batch process. Entities can be inserted, replaced or deleted.

func (*TableBatch) DeleteEntity

func (t *TableBatch) DeleteEntity(entity *Entity, force bool)

DeleteEntity adds an entity in preparation for a batch delete

func (*TableBatch) DeleteEntityByForce

func (t *TableBatch) DeleteEntityByForce(entity *Entity, force bool)

DeleteEntityByForce adds an entity in preparation for a batch delete. Forces regardless of ETag

func (*TableBatch) ExecuteBatch

func (t *TableBatch) ExecuteBatch() error

ExecuteBatch executes many table operations in one request to Azure. The operations can be combinations of Insert, Delete, Replace and Merge Creates the inner changeset body (various operations, Insert, Delete etc) then creates the outer request packet that encompasses the changesets. As per document https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/performing-entity-group-transactions

func (*TableBatch) InsertEntity

func (t *TableBatch) InsertEntity(entity *Entity)

InsertEntity adds an entity in preparation for a batch insert.

func (*TableBatch) InsertOrMergeEntity

func (t *TableBatch) InsertOrMergeEntity(entity *Entity, force bool)

InsertOrMergeEntity adds an entity in preparation for a batch insert or merge.

func (*TableBatch) InsertOrMergeEntityByForce

func (t *TableBatch) InsertOrMergeEntityByForce(entity *Entity)

InsertOrMergeEntityByForce adds an entity in preparation for a batch insert or merge. Forces regardless of ETag

func (*TableBatch) InsertOrReplaceEntity

func (t *TableBatch) InsertOrReplaceEntity(entity *Entity, force bool)

InsertOrReplaceEntity adds an entity in preparation for a batch insert or replace.

func (*TableBatch) InsertOrReplaceEntityByForce

func (t *TableBatch) InsertOrReplaceEntityByForce(entity *Entity)

InsertOrReplaceEntityByForce adds an entity in preparation for a batch insert or replace. Forces regardless of ETag

func (*TableBatch) MergeEntity

func (t *TableBatch) MergeEntity(entity *Entity)

MergeEntity adds an entity in preparation for a batch merge

func (*TableBatch) ReplaceEntity

func (t *TableBatch) ReplaceEntity(entity *Entity)

ReplaceEntity adds an entity in preparation for a batch replace.

type TableOptions

type TableOptions struct {
	RequestID string
}

TableOptions includes options for some table operations

type TableQueryResult

type TableQueryResult struct {
	OdataMetadata string  `json:"odata.metadata"`
	Tables        []Table `json:"value"`
	QueryNextLink
	// contains filtered or unexported fields
}

TableQueryResult contains the response from QueryTables and QueryTablesNextResults functions.

func (*TableQueryResult) NextResults

func (tqr *TableQueryResult) NextResults(options *TableOptions) (*TableQueryResult, error)

NextResults returns the next page of results from a QueryTables or a NextResults operation.

See https://docs.microsoft.com/rest/api/storageservices/fileservices/query-tables See https://docs.microsoft.com/rest/api/storageservices/fileservices/query-timeout-and-pagination

type TableServiceClient

type TableServiceClient struct {
	// contains filtered or unexported fields
}

TableServiceClient contains operations for Microsoft Azure Table Storage Service.

func (*TableServiceClient) GetServiceProperties

func (t *TableServiceClient) GetServiceProperties() (*ServiceProperties, error)

GetServiceProperties gets the properties of your storage account's table service. See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-table-service-properties

func (*TableServiceClient) GetTableReference

func (t *TableServiceClient) GetTableReference(name string) *Table

GetTableReference returns a Table object for the specified table name.

func (*TableServiceClient) QueryTables

QueryTables returns the tables in the storage account. You can use query options defined by the OData Protocol specification.

See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-tables

func (*TableServiceClient) SetServiceProperties

func (t *TableServiceClient) SetServiceProperties(props ServiceProperties) error

SetServiceProperties sets the properties of your storage account's table service. See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-table-service-properties

type TimeRFC1123

type TimeRFC1123 time.Time

TimeRFC1123 is an alias for time.Time needed for custom Unmarshalling

func (*TimeRFC1123) MarshalXML

func (t *TimeRFC1123) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML marshals using time.RFC1123.

func (*TimeRFC1123) UnmarshalXML

func (t *TimeRFC1123) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML is a custom unmarshaller that overrides the default time unmarshal which uses a different time layout.

type UnexpectedStatusCodeError

type UnexpectedStatusCodeError struct {
	// contains filtered or unexported fields
}

UnexpectedStatusCodeError is returned when a storage service responds with neither an error nor with an HTTP status code indicating success.

func (UnexpectedStatusCodeError) Error

func (UnexpectedStatusCodeError) Got

Got is the actual status code returned by Azure.

func (UnexpectedStatusCodeError) Inner

func (e UnexpectedStatusCodeError) Inner() error

Inner returns any inner error info.

type UpdateMessageOptions

type UpdateMessageOptions struct {
	Timeout           uint
	VisibilityTimeout int
	RequestID         string `header:"x-ms-client-request-id"`
}

UpdateMessageOptions is the set of options can be specified for Update Messsage operation. A zero struct does not use any preferences for the request.

type WriteRangeOptions

type WriteRangeOptions struct {
	Timeout    uint
	ContentMD5 string
}

WriteRangeOptions includes options for a write file range operation

Jump to

Keyboard shortcuts

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