storage

package
v8.0.0-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2017 License: Apache-2.0 Imports: 18 Imported by: 1,459

README

Azure Storage SDK for Go

The github.com/Azure/azure-sdk-for-go/storage package is used to perform operations in Azure Storage Service. To manage your storage accounts (Azure Resource Manager / ARM), use the github.com/Azure/azure-sdk-for-go/arm/storage package. For your classic storage accounts (Azure Service Management / ASM), use github.com/Azure/azure-sdk-for-go/management/storageservice package.

This package includes support for Azure Storage Emulator

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 = 4 * 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 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 = "2015-02-21"

	// 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 (
	ContainerAccessHeader string = "x-ms-blob-public-access"
)

ContainerAccessHeader references header used when setting/getting container ACL

Variables

This section is empty.

Functions

This section is empty.

Types

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 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"`
	StatusCode                int
	RequestID                 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 AzureTable

type AzureTable string

AzureTable is the typedef of the Azure Table name

type Blob

type Blob struct {
	Name       string         `xml:"Name"`
	Properties BlobProperties `xml:"Properties"`
	Metadata   BlobMetadata   `xml:"Metadata"`
}

A Blob is an entry in BlobListResponse.

type BlobHeaders

type BlobHeaders struct {
	ContentMD5      string `header:"x-ms-blob-content-md5"`
	ContentLanguage string `header:"x-ms-blob-content-language"`
	ContentEncoding string `header:"x-ms-blob-content-encoding"`
	ContentType     string `header:"x-ms-blob-content-type"`
	CacheControl    string `header:"x-ms-blob-cache-control"`
}

BlobHeaders contains various properties of a blob and is an entry in SetBlobProperties

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          string   `xml:"Last-Modified"`
	Etag                  string   `xml:"Etag"`
	ContentMD5            string   `xml:"Content-MD5"`
	ContentLength         int64    `xml:"Content-Length"`
	ContentType           string   `xml:"Content-Type"`
	ContentEncoding       string   `xml:"Content-Encoding"`
	CacheControl          string   `xml:"Cache-Control"`
	ContentLanguage       string   `xml:"Cache-Language"`
	BlobType              BlobType `xml:"x-ms-blob-blob-type"`
	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    string   `xml:"CopyCompletionTime"`
	CopyStatusDescription string   `xml:"CopyStatusDescription"`
	LeaseStatus           string   `xml:"LeaseStatus"`
	LeaseState            string   `xml:"LeaseState"`
}

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

type BlobStorageClient

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

BlobStorageClient contains operations for Microsoft Azure Blob Storage Service.

func (BlobStorageClient) AbortBlobCopy

func (b BlobStorageClient) AbortBlobCopy(container, name, copyID, currentLeaseID string, timeout int) error

AbortBlobCopy 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. As defined in https://msdn.microsoft.com/en-us/library/azure/jj159098.aspx

func (BlobStorageClient) AcquireLease

func (b BlobStorageClient) AcquireLease(container string, name string, leaseTimeInSeconds int, proposedLeaseID string) (returnedLeaseID string, err error)

AcquireLease creates a lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx returns leaseID acquired

func (BlobStorageClient) AppendBlock

func (b BlobStorageClient) AppendBlock(container, name string, chunk []byte, extraHeaders map[string]string) error

AppendBlock appends a block to an append blob.

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

func (BlobStorageClient) BlobExists

func (b BlobStorageClient) BlobExists(container, name string) (bool, error)

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

func (BlobStorageClient) BreakLease

func (b BlobStorageClient) BreakLease(container string, name string) (breakTimeout int, err error)

BreakLease breaks the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx Returns the timeout remaining in the lease in seconds

func (BlobStorageClient) BreakLeaseWithBreakPeriod

func (b BlobStorageClient) BreakLeaseWithBreakPeriod(container string, name string, breakPeriodInSeconds int) (breakTimeout int, err error)

BreakLeaseWithBreakPeriod breaks the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx breakPeriodInSeconds is used to determine how long until new lease can be created. Returns the timeout remaining in the lease in seconds

func (BlobStorageClient) ChangeLease

func (b BlobStorageClient) ChangeLease(container string, name string, currentLeaseID string, proposedLeaseID string) (newLeaseID string, err error)

ChangeLease changes a lease ID for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx Returns the new LeaseID acquired

func (BlobStorageClient) ContainerExists

func (b BlobStorageClient) ContainerExists(name string) (bool, error)

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

func (BlobStorageClient) CopyBlob

func (b BlobStorageClient) CopyBlob(container, name, sourceBlob string) error

CopyBlob 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 GetBlobURL method.) There is no SLA on blob copy and therefore this helper method works faster on smaller files.

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

func (BlobStorageClient) CreateBlockBlob

func (b BlobStorageClient) CreateBlockBlob(container, name string) error

CreateBlockBlob initializes an empty block blob with no blocks.

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

func (BlobStorageClient) CreateBlockBlobFromReader

func (b BlobStorageClient) CreateBlockBlobFromReader(container, name string, size uint64, blob io.Reader, extraHeaders map[string]string) 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.

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

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

func (BlobStorageClient) CreateContainer

func (b BlobStorageClient) CreateContainer(name string, access ContainerAccessType) error

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

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

func (BlobStorageClient) CreateContainerIfNotExists

func (b BlobStorageClient) CreateContainerIfNotExists(name string, access ContainerAccessType) (bool, error)

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

func (BlobStorageClient) DeleteBlob

func (b BlobStorageClient) DeleteBlob(container, name string, extraHeaders map[string]string) error

DeleteBlob 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://msdn.microsoft.com/en-us/library/azure/dd179413.aspx

func (BlobStorageClient) DeleteBlobIfExists

func (b BlobStorageClient) DeleteBlobIfExists(container, name string, extraHeaders map[string]string) (bool, error)

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

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

func (BlobStorageClient) DeleteContainer

func (b BlobStorageClient) DeleteContainer(name string) error

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

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

func (BlobStorageClient) DeleteContainerIfExists

func (b BlobStorageClient) DeleteContainerIfExists(name string) (bool, error)

DeleteContainerIfExists 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://msdn.microsoft.com/en-us/library/azure/dd179408.aspx

func (BlobStorageClient) GetBlob

func (b BlobStorageClient) GetBlob(container, name string) (io.ReadCloser, error)

GetBlob returns a stream to read the blob. Caller must call Close() the reader to close on the underlying connection.

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

func (BlobStorageClient) GetBlobMetadata

func (b BlobStorageClient) GetBlobMetadata(container, name string) (map[string]string, error)

GetBlobMetadata 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 (BlobStorageClient) GetBlobProperties

func (b BlobStorageClient) GetBlobProperties(container, name string) (*BlobProperties, error)

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

func (BlobStorageClient) GetBlobRange

func (b BlobStorageClient) GetBlobRange(container, name, bytesRange string, extraHeaders map[string]string) (io.ReadCloser, error)

GetBlobRange 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.

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

func (BlobStorageClient) GetBlobSASURI

func (b BlobStorageClient) GetBlobSASURI(container, name string, expiry time.Time, permissions string) (string, error)

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

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

func (BlobStorageClient) GetBlobSASURIWithSignedIPAndProtocol

func (b BlobStorageClient) GetBlobSASURIWithSignedIPAndProtocol(container, name string, expiry time.Time, permissions string, signedIPRange string, HTTPSOnly bool) (string, error)

GetBlobSASURIWithSignedIPAndProtocol creates an URL to the specified blob which contains the Shared Access Signature with specified permissions and expiration time. Also includes signedIPRange and allowed protocols. If old API version is used but no signedIP is passed (ie empty string) then this should still work. We only populate the signedIP when it non-empty.

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

func (BlobStorageClient) GetBlobURL

func (b BlobStorageClient) GetBlobURL(container, name string) string

GetBlobURL 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 (BlobStorageClient) GetBlockList

func (b BlobStorageClient) GetBlockList(container, name string, blockType BlockListType) (BlockListResponse, error)

GetBlockList retrieves list of blocks in the specified block blob.

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

func (BlobStorageClient) GetContainerPermissions

func (b BlobStorageClient) GetContainerPermissions(container string, timeout int, leaseID string) (*ContainerPermissions, error)

GetContainerPermissions 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 Returns permissionResponse which is combined permissions and AccessPolicy

func (BlobStorageClient) GetPageRanges

func (b BlobStorageClient) GetPageRanges(container, name string) (GetPageRangesResponse, error)

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

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

func (BlobStorageClient) ListBlobs

func (b BlobStorageClient) ListBlobs(container string, 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://msdn.microsoft.com/en-us/library/azure/dd135734.aspx

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) PutAppendBlob

func (b BlobStorageClient) PutAppendBlob(container, name string, extraHeaders map[string]string) error

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

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

func (BlobStorageClient) PutBlock

func (b BlobStorageClient) PutBlock(container, name, blockID string, chunk []byte) error

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

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

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

func (BlobStorageClient) PutBlockList

func (b BlobStorageClient) PutBlockList(container, name string, blocks []Block) error

PutBlockList saves list of blocks to the specified block blob.

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

func (BlobStorageClient) PutBlockWithLength

func (b BlobStorageClient) PutBlockWithLength(container, name, blockID string, size uint64, blob io.Reader, extraHeaders map[string]string) 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 > 4 MiB (but this limit is not checked by the SDK).

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

func (BlobStorageClient) PutPage

func (b BlobStorageClient) PutPage(container, name string, startByte, endByte int64, writeType PageWriteType, chunk []byte, extraHeaders map[string]string) error

PutPage writes a range of pages to a page blob or clears the given range. In case of 'clear' writes, given chunk is discarded. Ranges must be aligned with 512-byte boundaries and chunk must be of size multiplies by 512.

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

func (BlobStorageClient) PutPageBlob

func (b BlobStorageClient) PutPageBlob(container, name string, size int64, extraHeaders map[string]string) 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 https://msdn.microsoft.com/en-us/library/azure/dd179451.aspx

func (BlobStorageClient) ReleaseLease

func (b BlobStorageClient) ReleaseLease(container string, name string, currentLeaseID string) error

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

func (BlobStorageClient) RenewLease

func (b BlobStorageClient) RenewLease(container string, name string, currentLeaseID string) error

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

func (BlobStorageClient) SetBlobMetadata

func (b BlobStorageClient) SetBlobMetadata(container, name string, metadata map[string]string, extraHeaders map[string]string) error

SetBlobMetadata 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 (BlobStorageClient) SetBlobProperties

func (b BlobStorageClient) SetBlobProperties(container, name string, blobHeaders BlobHeaders) error

SetBlobProperties 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://msdn.microsoft.com/en-us/library/azure/ee691966.aspx

func (BlobStorageClient) SetContainerPermissions

func (b BlobStorageClient) SetContainerPermissions(container string, containerPermissions ContainerPermissions, timeout int, leaseID string) (err error)

SetContainerPermissions sets up container permissions as per https://msdn.microsoft.com/en-us/library/azure/dd179391.aspx

func (BlobStorageClient) SnapshotBlob

func (b BlobStorageClient) SnapshotBlob(container string, name string, timeout int, extraHeaders map[string]string) (snapshotTimestamp *time.Time, err error)

SnapshotBlob creates a snapshot for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691971.aspx

func (BlobStorageClient) StartBlobCopy

func (b BlobStorageClient) StartBlobCopy(container, name, sourceBlob string) (string, error)

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

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

func (BlobStorageClient) WaitForBlobCopy

func (b BlobStorageClient) WaitForBlobCopy(container, name, copyID string) error

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

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.  If it is nil, http.DefaultClient is used.
	HTTPClient *http.Client

	UseSharedKeyLite bool
	// contains filtered or unexported fields
}

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

func NewBasicClient

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

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

func NewClient

func NewClient(accountName, accountKey, blobServiceBaseURL, 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 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) 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"`
}

A Container is an entry in ContainerListResponse.

type ContainerAccessPolicyDetails

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

ContainerAccessPolicyDetails are used for SETTING container policies

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 ContainerPermissions

type ContainerPermissions struct {
	AccessType     ContainerAccessType
	AccessPolicies []ContainerAccessPolicyDetails
}

ContainerPermissions is used when setting permissions and Access Policies for containers.

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"`
}

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

type ContinuationToken

type ContinuationToken struct {
	NextPartitionKey string
	NextRowKey       string
}

ContinuationToken is an opaque (ie not useful to inspect) struct that Get... methods can return if there are more entries to be returned than the ones already returned. Just pass it to the same function to continue receiving the remaining entries.

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() error

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

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

func (*Directory) CreateIfNotExists

func (d *Directory) CreateIfNotExists() (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://msdn.microsoft.com/en-us/library/azure/dn166993.aspx

func (*Directory) Delete

func (d *Directory) Delete() 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://msdn.microsoft.com/en-us/library/azure/dn166969.aspx

func (*Directory) DeleteIfExists

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

DeleteIfExists removes this directory if it exists.

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

func (*Directory) Exists

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

Exists returns true if this directory exists.

func (*Directory) FetchAttributes

func (d *Directory) FetchAttributes() error

FetchAttributes retrieves metadata for this directory.

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://msdn.microsoft.com/en-us/library/azure/dn166980.aspx

func (*Directory) SetMetadata

func (d *Directory) SetMetadata() 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://msdn.microsoft.com/en-us/library/azure/mt427370.aspx

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://msdn.microsoft.com/en-us/library/azure/dn166980.aspx

type File

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

	Properties FileProperties `xml:"Properties"`
	// contains filtered or unexported fields
}

File represents a file on a share.

func (*File) ClearRange

func (f *File) ClearRange(fileRange FileRange) error

ClearRange releases the specified range of space in a file.

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

func (*File) Create

func (f *File) Create(maxSize uint64) error

Create creates a new file or replaces an existing one.

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

func (*File) Delete

func (f *File) Delete() error

Delete immediately removes this file from the storage account.

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

func (*File) DeleteIfExists

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

DeleteIfExists removes this file if it exists.

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

func (*File) DownloadRangeToStream

func (f *File) DownloadRangeToStream(fileRange FileRange, getContentMD5 bool) (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) Exists

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

Exists returns true if this file exists.

func (*File) FetchAttributes

func (f *File) FetchAttributes() error

FetchAttributes updates metadata and properties for this file.

func (*File) ListRanges

func (f *File) ListRanges(listRange *FileRange) (*FileRanges, error)

ListRanges returns the list of valid ranges for this file.

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

func (*File) SetMetadata

func (f *File) SetMetadata() 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://msdn.microsoft.com/en-us/library/azure/dn689097.aspx

func (*File) SetProperties

func (f *File) SetProperties() 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://msdn.microsoft.com/en-us/library/azure/dn166975.aspx

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, contentMD5 *string) error

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

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

type FileCopyState

type FileCopyState struct {
	CompletionTime string
	ID             string
	Progress       string
	Source         string
	Status         string
	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"`
	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://msdn.microsoft.com/en-us/library/azure/dn166984.aspx

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://msdn.microsoft.com/en-us/library/azure/dn166984.aspx

type FileServiceClient

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

FileServiceClient contains operations for Microsoft Azure File Service.

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://msdn.microsoft.com/en-us/library/azure/dd179352.aspx

type FileStream

type FileStream struct {
	Body       io.ReadCloser
	ContentMD5 string
}

FileStream contains file data returned from a call to GetFile.

type GetMessageResponse

type GetMessageResponse struct {
	MessageID       string `xml:"MessageId"`
	InsertionTime   string `xml:"InsertionTime"`
	ExpirationTime  string `xml:"ExpirationTime"`
	PopReceipt      string `xml:"PopReceipt"`
	TimeNextVisible string `xml:"TimeNextVisible"`
	DequeueCount    int    `xml:"DequeueCount"`
	MessageText     string `xml:"MessageText"`
}

GetMessageResponse represents a QueueMessage object returned from Get Messages operation response.

type GetMessagesParameters

type GetMessagesParameters struct {
	NumOfMessages     int
	VisibilityTimeout int
}

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

type GetMessagesResponse

type GetMessagesResponse struct {
	XMLName           xml.Name             `xml:"QueueMessagesList"`
	QueueMessagesList []GetMessageResponse `xml:"QueueMessage"`
}

GetMessagesResponse represents a response returned from Get Messages 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 ListBlobsParameters

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

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 {
	Marker     string
	MaxResults uint
	Timeout    uint
}

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

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

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://msdn.microsoft.com/en-us/library/azure/dn167009.aspx

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 PageWriteType

type PageWriteType string

PageWriteType defines the type updates that are going to be done on the page blob.

const (
	PageWriteTypeUpdate PageWriteType = "update"
	PageWriteTypeClear  PageWriteType = "clear"
)

Types of operations on page blobs

type PeekMessageResponse

type PeekMessageResponse struct {
	MessageID      string `xml:"MessageId"`
	InsertionTime  string `xml:"InsertionTime"`
	ExpirationTime string `xml:"ExpirationTime"`
	DequeueCount   int    `xml:"DequeueCount"`
	MessageText    string `xml:"MessageText"`
}

PeekMessageResponse represents a QueueMessage object returned from Peek Messages operation response.

type PeekMessagesParameters

type PeekMessagesParameters struct {
	NumOfMessages int
}

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

type PeekMessagesResponse

type PeekMessagesResponse struct {
	XMLName           xml.Name              `xml:"QueueMessagesList"`
	QueueMessagesList []PeekMessageResponse `xml:"QueueMessage"`
}

PeekMessagesResponse represents a response returned from Get Messages operation.

type PutMessageParameters

type PutMessageParameters struct {
	VisibilityTimeout int
	MessageTTL        int
}

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

type QueueMetadataResponse

type QueueMetadataResponse struct {
	ApproximateMessageCount int
	UserDefinedMetadata     map[string]string
}

QueueMetadataResponse represents user defined metadata and queue properties on a specific queue.

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

type QueueServiceClient

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

QueueServiceClient contains operations for Microsoft Azure Queue Storage Service.

func (QueueServiceClient) ClearMessages

func (c QueueServiceClient) ClearMessages(queue string) error

ClearMessages operation deletes all messages from the specified queue.

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

func (QueueServiceClient) CreateQueue

func (c QueueServiceClient) CreateQueue(name string) error

CreateQueue operation creates a queue under the given account.

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

func (QueueServiceClient) DeleteMessage

func (c QueueServiceClient) DeleteMessage(queue, messageID, popReceipt string) error

DeleteMessage operation deletes the specified message.

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

func (QueueServiceClient) DeleteQueue

func (c QueueServiceClient) DeleteQueue(name string) error

DeleteQueue operation permanently deletes the specified queue.

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

func (QueueServiceClient) GetMessages

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

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

func (QueueServiceClient) GetMetadata

func (c QueueServiceClient) GetMetadata(name string) (QueueMetadataResponse, 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://msdn.microsoft.com/en-us/library/azure/dd179384.aspx

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 (QueueServiceClient) PeekMessages

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

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

func (QueueServiceClient) PutMessage

func (c QueueServiceClient) PutMessage(queue string, message string, params PutMessageParameters) error

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

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

func (QueueServiceClient) QueueExists

func (c QueueServiceClient) QueueExists(name string) (bool, error)

QueueExists returns true if a queue with given name exists.

func (QueueServiceClient) SetMetadata

func (c QueueServiceClient) SetMetadata(name string, metadata map[string]string) error

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

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

func (QueueServiceClient) UpdateMessage

func (c QueueServiceClient) UpdateMessage(queue string, messageID string, message string, params UpdateMessageParameters) error

UpdateMessage operation deletes the specified message.

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

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() error

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

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

func (*Share) CreateIfNotExists

func (s *Share) CreateIfNotExists() (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://msdn.microsoft.com/en-us/library/azure/dn167008.aspx

func (*Share) Delete

func (s *Share) Delete() 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://msdn.microsoft.com/en-us/library/azure/dn689090.aspx

func (*Share) DeleteIfExists

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

DeleteIfExists operation marks this share for deletion if it exists.

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

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() error

FetchAttributes retrieves metadata and properties for this share.

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() 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://msdn.microsoft.com/en-us/library/azure/dd179414.aspx

func (*Share) SetProperties

func (s *Share) SetProperties() 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://msdn.microsoft.com/en-us/library/azure/mt427368.aspx

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://msdn.microsoft.com/en-us/library/azure/dn167009.aspx

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 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 TableEntity

type TableEntity interface {
	PartitionKey() string
	RowKey() string
	SetPartitionKey(string) error
	SetRowKey(string) error
}

TableEntity interface specifies the functions needed to support marshaling and unmarshaling into Azure Tables. The struct must only contain simple types because Azure Tables do not support hierarchy.

type TableServiceClient

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

TableServiceClient contains operations for Microsoft Azure Table Storage Service.

func (*TableServiceClient) CreateTable

func (c *TableServiceClient) CreateTable(table AzureTable) error

CreateTable creates the table given the specific name. This function fails if the name is not compliant with the specification or the tables already exists.

func (*TableServiceClient) DeleteEntity

func (c *TableServiceClient) DeleteEntity(table AzureTable, entity TableEntity, ifMatch string) error

DeleteEntity deletes the entity matching by PartitionKey, RowKey and ifMatch field. The function fails if there is no entity with the same PartitionKey and RowKey in the table or the ifMatch is different.

func (*TableServiceClient) DeleteEntityWithoutCheck

func (c *TableServiceClient) DeleteEntityWithoutCheck(table AzureTable, entity TableEntity) error

DeleteEntityWithoutCheck deletes the entity matching by PartitionKey and RowKey. There is no check on IfMatch parameter so the entity is always deleted. The function fails if there is no entity with the same PartitionKey and RowKey in the table.

func (*TableServiceClient) DeleteTable

func (c *TableServiceClient) DeleteTable(table AzureTable) error

DeleteTable deletes the table given the specific name. This function fails if the table is not present. Be advised: DeleteTable deletes all the entries that may be present.

func (*TableServiceClient) GetTablePermissions

func (c *TableServiceClient) GetTablePermissions(table AzureTable, timeout int) (permissionResponse []TableAccessPolicy, err error)

GetTablePermissions gets the table ACL permissions, as per REST details https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-table-acl

func (*TableServiceClient) InsertEntity

func (c *TableServiceClient) InsertEntity(table AzureTable, entity TableEntity) error

InsertEntity inserts an entity in the specified table. The function fails if there is an entity with the same PartitionKey and RowKey in the table.

func (*TableServiceClient) InsertOrMergeEntity

func (c *TableServiceClient) InsertOrMergeEntity(table AzureTable, entity TableEntity) error

InsertOrMergeEntity inserts an entity in the specified table or merges the existing one.

func (*TableServiceClient) InsertOrReplaceEntity

func (c *TableServiceClient) InsertOrReplaceEntity(table AzureTable, entity TableEntity) error

InsertOrReplaceEntity inserts an entity in the specified table or replaced the existing one.

func (*TableServiceClient) MergeEntity

func (c *TableServiceClient) MergeEntity(table AzureTable, entity TableEntity) error

MergeEntity merges the contents of an entity with the one passed as parameter. The function fails if there is no entity with the same PartitionKey and RowKey in the table.

func (*TableServiceClient) QueryTableEntities

func (c *TableServiceClient) QueryTableEntities(tableName AzureTable, previousContToken *ContinuationToken, retType reflect.Type, top int, query string) ([]TableEntity, *ContinuationToken, error)

QueryTableEntities queries the specified table and returns the unmarshaled entities of type retType. top parameter limits the returned entries up to top. Maximum top allowed by Azure API is 1000. In case there are more than top entries to be returned the function will return a non nil *ContinuationToken. You can call the same function again passing the received ContinuationToken as previousContToken parameter in order to get the following entries. The query parameter is the odata query. To retrieve all the entries pass the empty string. The function returns a pointer to a TableEntity slice, the *ContinuationToken if there are more entries to be returned and an error in case something went wrong.

Example:

entities, cToken, err = tSvc.QueryTableEntities("table", cToken, reflect.TypeOf(entity), 20, "")

func (*TableServiceClient) QueryTables

func (c *TableServiceClient) QueryTables() ([]AzureTable, error)

QueryTables returns the tables created in the *TableServiceClient storage account.

func (*TableServiceClient) SetTablePermissions

func (c *TableServiceClient) SetTablePermissions(table AzureTable, policies []TableAccessPolicy, timeout uint) (err error)

SetTablePermissions sets up table ACL permissions as per REST details https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Table-ACL

func (*TableServiceClient) UpdateEntity

func (c *TableServiceClient) UpdateEntity(table AzureTable, entity TableEntity) error

UpdateEntity updates the contents of an entity with the one passed as parameter. The function fails if there is no entity with the same PartitionKey and RowKey in the table.

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.

type UpdateMessageParameters

type UpdateMessageParameters struct {
	PopReceipt        string
	VisibilityTimeout int
}

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

Jump to

Keyboard shortcuts

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