blobs

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

README

Blob Storage Blobs SDK for API version 2023-11-03

This package allows you to interact with the Blobs Blob Storage API

Supported Authorizers

  • Azure Active Directory (for the Resource Endpoint https://storage.azure.com)
  • SharedKeyLite (Blob, File & Queue)

Example Usage

package main

import (
	"context"
	"fmt"
	"time"
	
	"github.com/hashicorp/go-azure-sdk/sdk/auth"
	"github.com/tombuildsstuff/giovanni/storage/2023-11-03/blob/blobs"
)

func Example() error {
	accountName := "storageaccount1"
    storageAccountKey := "ABC123...."
    containerName := "mycontainer"
	domainSuffix := "core.windows.net"
    fileName := "example-large-file.iso"

	blobClient, err := blobs.NewWithBaseUri(fmt.Sprintf("https://%s.blob.%s", accountName, domainSuffix))
	if err != nil {
		return fmt.Errorf("building client for environment: %v", err)
	}
	
	auth, err := auth.NewSharedKeyAuthorizer(accountName, storageAccountKey, auth.SharedKey)
	if err != nil {
		return fmt.Errorf("building SharedKey authorizer: %+v", err)
	}
	blobClient.Client.SetAuthorizer(auth)
    
    ctx := context.TODO()
    copyInput := blobs.CopyInput{
        CopySource: "http://releases.ubuntu.com/14.04/ubuntu-14.04.6-desktop-amd64.iso",
    }
    refreshInterval := 5 * time.Second
    if err := blobClient.CopyAndWait(ctx, containerName, fileName, copyInput, refreshInterval); err != nil {
        return fmt.Errorf("Error copying: %s", err)
    }
    
    return nil 
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCopyAndWaitPoller

func NewCopyAndWaitPoller(client *Client, containerName, blobName string, getPropertiesInput GetPropertiesInput) *copyAndWaitPoller

Types

type AbortCopyInput

type AbortCopyInput struct {
	// The Copy ID which should be aborted
	CopyID string

	// The ID of the Lease
	// This must be specified if a Lease is present on the Blob, else a 403 is returned
	LeaseID *string
}

type AccessTier

type AccessTier string
var (
	Archive AccessTier = "Archive"
	Cool    AccessTier = "Cool"
	Hot     AccessTier = "Hot"
)

type AcquireLeaseInput

type AcquireLeaseInput struct {
	// The ID of the existing Lease, if leased
	LeaseID *string

	// Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires.
	// A non-infinite lease can be between 15 and 60 seconds
	LeaseDuration int

	// The Proposed new ID for the Lease
	ProposedLeaseID *string
}

type AcquireLeaseResponse

type AcquireLeaseResponse struct {
	HttpResponse *http.Response

	LeaseID string
}

type AppendBlockInput

type AppendBlockInput struct {
	// A number indicating the byte offset to compare.
	// Append Block will succeed only if the append position is equal to this number.
	// If it is not, the request will fail with an AppendPositionConditionNotMet
	// error (HTTP status code 412 – Precondition Failed)
	BlobConditionAppendPosition *int64

	// The max length in bytes permitted for the append blob.
	// If the Append Block operation would cause the blob to exceed that limit or if the blob size
	// is already greater than the value specified in this header, the request will fail with
	// an MaxBlobSizeConditionNotMet error (HTTP status code 412 – Precondition Failed).
	BlobConditionMaxSize *int64

	// The Bytes which should be appended to the end of this Append Blob.
	// This can either be nil, which creates an empty blob, or a byte array
	Content *[]byte

	// An MD5 hash of the block content.
	// This hash is used to verify the integrity of the block during transport.
	// When this header is specified, the storage service compares the hash of the content
	// that has arrived with this header value.
	//
	// Note that this MD5 hash is not stored with the blob.
	// If the two hashes do not match, the operation will fail with error code 400 (Bad Request).
	ContentMD5 *string

	// Required if the blob has an active lease.
	// To perform this operation on a blob with an active lease, specify the valid lease ID for this header.
	LeaseID *string

	// The encryption scope to set for the request content.
	EncryptionScope *string
}

type AppendBlockResponse

type AppendBlockResponse struct {
	HttpResponse *http.Response

	BlobAppendOffset        string
	BlobCommittedBlockCount int64
	ContentMD5              string
	ETag                    string
	LastModified            string
}

type ArchiveStatus

type ArchiveStatus string
var (
	None                   ArchiveStatus = ""
	RehydratePendingToCool ArchiveStatus = "rehydrate-pending-to-cool"
	RehydratePendingToHot  ArchiveStatus = "rehydrate-pending-to-hot"
)

type BlobId added in v0.22.0

type BlobId struct {
	// AccountId specifies the ID of the Storage Account where this Blob exists.
	AccountId accounts.AccountId

	// ContainerName specifies the name of the Container within this Storage Account where this
	// Blob exists.
	ContainerName string

	// BlobName specifies the name of this Blob.
	BlobName string
}

func NewBlobID added in v0.22.0

func NewBlobID(accountId accounts.AccountId, containerName, blobName string) BlobId

func ParseBlobID added in v0.22.0

func ParseBlobID(input, domainSuffix string) (*BlobId, error)

ParseBlobID parses `input` into a Blob ID using a known `domainSuffix`

func (BlobId) ID added in v0.22.0

func (b BlobId) ID() string

func (BlobId) String added in v0.22.0

func (b BlobId) String() string

type BlobType

type BlobType string
var (
	AppendBlob BlobType = "AppendBlob"
	BlockBlob  BlobType = "BlockBlob"
	PageBlob   BlobType = "PageBlob"
)

type Block

type Block struct {
	// The base64-encoded Block ID
	Name string `xml:"Name"`

	// The size of the Block in Bytes
	Size int64 `xml:"Size"`
}

type BlockID

type BlockID struct {
	Value string `xml:",chardata"`
}

type BlockList

type BlockList struct {
	CommittedBlockIDs   []BlockID `xml:"Committed,omitempty"`
	UncommittedBlockIDs []BlockID `xml:"Uncommitted,omitempty"`
	LatestBlockIDs      []BlockID `xml:"Latest,omitempty"`
}

type BlockListType

type BlockListType string
var (
	All         BlockListType = "all"
	Committed   BlockListType = "committed"
	Uncommitted BlockListType = "uncommitted"
)

type BreakLeaseInput

type BreakLeaseInput struct {
	//  For a break operation, proposed duration the lease should continue
	//  before it is broken, in seconds, between 0 and 60.
	//  This break period is only used if it is shorter than the time remaining on the lease.
	//  If longer, the time remaining on the lease is used.
	//  A new lease will not be available before the break period has expired,
	//  but the lease may be held for longer than the break period.
	//  If this header does not appear with a break operation, a fixed-duration lease breaks
	//  after the remaining lease period elapses, and an infinite lease breaks immediately.
	BreakPeriod *int

	LeaseID string
}

type BreakLeaseResponse

type BreakLeaseResponse struct {
	HttpResponse *http.Response

	// Approximate time remaining in the lease period, in seconds.
	// If the break is immediate, 0 is returned.
	LeaseTime int
}

type ChangeLeaseInput

type ChangeLeaseInput struct {
	ExistingLeaseID string
	ProposedLeaseID string
}

type ChangeLeaseResponse

type ChangeLeaseResponse struct {
	HttpResponse *http.Response

	LeaseID string
}

type Client

type Client struct {
	Client *storage.Client
}

Client is the base client for Blob Storage Blobs.

func NewWithBaseUri

func NewWithBaseUri(baseUri string) (*Client, error)

func (Client) AbortCopy

func (c Client) AbortCopy(ctx context.Context, containerName, blobName string, input AbortCopyInput) (result CopyAbortResponse, err error)

AbortCopy aborts a pending Copy Blob operation, and leaves a destination blob with zero length and full metadata.

func (Client) AcquireLease

func (c Client) AcquireLease(ctx context.Context, containerName, blobName string, input AcquireLeaseInput) (result AcquireLeaseResponse, err error)

AcquireLease establishes and manages a lock on a blob for write and delete operations.

func (Client) AppendBlock

func (c Client) AppendBlock(ctx context.Context, containerName, blobName string, input AppendBlockInput) (result AppendBlockResponse, err error)

AppendBlock commits a new block of data to the end of an existing append blob.

func (Client) BreakLease

func (c Client) BreakLease(ctx context.Context, containerName, blobName string, input BreakLeaseInput) (result BreakLeaseResponse, err error)

BreakLease breaks an existing lock on a blob using the LeaseID.

func (Client) ChangeLease

func (c Client) ChangeLease(ctx context.Context, containerName, blobName string, input ChangeLeaseInput) (result ChangeLeaseResponse, err error)

ChangeLease changes an existing lock on a blob for another lock.

func (Client) Copy

func (c Client) Copy(ctx context.Context, containerName, blobName string, input CopyInput) (result CopyResponse, err error)

Copy copies a blob to a destination within the storage account asynchronously.

func (Client) CopyAndWait

func (c Client) CopyAndWait(ctx context.Context, containerName, blobName string, input CopyInput) error

CopyAndWait copies a blob to a destination within the storage account and waits for it to finish copying.

func (Client) Delete

func (c Client) Delete(ctx context.Context, containerName, blobName string, input DeleteInput) (result DeleteResponse, err error)

Delete marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection.

func (Client) DeleteSnapshot

func (c Client) DeleteSnapshot(ctx context.Context, containerName, blobName string, input DeleteSnapshotInput) (result DeleteSnapshotResponse, err error)

DeleteSnapshot marks a single Snapshot of a Blob for Deletion based on it's DateTime, which will be deleted during the next Garbage Collection cycle.

func (Client) DeleteSnapshots

func (c Client) DeleteSnapshots(ctx context.Context, containerName, blobName string, input DeleteSnapshotsInput) (result DeleteSnapshotsResponse, err error)

DeleteSnapshots marks all Snapshots of a Blob for Deletion, which will be deleted during the next Garbage Collection Cycle.

func (Client) Get

func (c Client) Get(ctx context.Context, containerName, blobName string, input GetInput) (result GetResponse, err error)

Get reads or downloads a blob from the system, including its metadata and properties.

func (Client) GetBlockList

func (c Client) GetBlockList(ctx context.Context, containerName, blobName string, input GetBlockListInput) (result GetBlockListResponse, err error)

GetBlockList retrieves the list of blocks that have been uploaded as part of a block blob.

func (Client) GetPageRanges

func (c Client) GetPageRanges(ctx context.Context, containerName, blobName string, input GetPageRangesInput) (result GetPageRangesResponse, err error)

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

func (Client) GetProperties

func (c Client) GetProperties(ctx context.Context, containerName, blobName string, input GetPropertiesInput) (result GetPropertiesResponse, err error)

GetProperties returns all user-defined metadata, standard HTTP properties, and system properties for the blob

func (Client) GetSnapshotProperties

func (c Client) GetSnapshotProperties(ctx context.Context, containerName, blobName string, input GetSnapshotPropertiesInput) (result GetPropertiesResponse, err error)

GetSnapshotProperties returns all user-defined metadata, standard HTTP properties, and system properties for the specified snapshot of a blob

func (Client) IncrementalCopyBlob

func (c Client) IncrementalCopyBlob(ctx context.Context, containerName, blobName string, input IncrementalCopyBlobInput) (result IncrementalCopyBlob, err error)

IncrementalCopyBlob copies a snapshot of the source page blob to a destination page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual.

func (Client) PutAppendBlob

func (c Client) PutAppendBlob(ctx context.Context, containerName, blobName string, input PutAppendBlobInput) (result PutAppendBlobResponse, err error)

PutAppendBlob is a wrapper around the Put API call (with a stricter input object) which creates a new append blob, or updates the content of an existing blob.

func (Client) PutBlock

func (c Client) PutBlock(ctx context.Context, containerName, blobName string, input PutBlockInput) (result PutBlockResponse, err error)

PutBlock creates a new block to be committed as part of a blob.

func (Client) PutBlockBlob

func (c Client) PutBlockBlob(ctx context.Context, containerName, blobName string, input PutBlockBlobInput) (result PutBlockBlobResponse, err error)

PutBlockBlob is a wrapper around the Put API call (with a stricter input object) which creates a new block append blob, or updates the content of an existing block blob.

func (Client) PutBlockBlobFromFile

func (c Client) PutBlockBlobFromFile(ctx context.Context, containerName, blobName string, file *os.File, input PutBlockBlobInput) error

PutBlockBlobFromFile is a helper method which takes a file, and automatically chunks it up, rather than having to do this yourself

func (Client) PutBlockFromURL

func (c Client) PutBlockFromURL(ctx context.Context, containerName, blobName string, input PutBlockFromURLInput) (result PutBlockFromURLResponse, err error)

PutBlockFromURL creates a new block to be committed as part of a blob where the contents are read from a URL

func (Client) PutBlockList

func (c Client) PutBlockList(ctx context.Context, containerName, blobName string, input PutBlockListInput) (result PutBlockListResponse, err error)

PutBlockList writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block operation.

func (Client) PutPageBlob

func (c Client) PutPageBlob(ctx context.Context, containerName, blobName string, input PutPageBlobInput) (result PutPageBlobResponse, err error)

PutPageBlob is a wrapper around the Put API call (with a stricter input object) which creates a new block blob, or updates the content of an existing page blob.

func (Client) PutPageClear

func (c Client) PutPageClear(ctx context.Context, containerName, blobName string, input PutPageClearInput) (result PutPageClearResponse, err error)

PutPageClear clears a range of pages within a page blob.

func (Client) PutPageUpdate

func (c Client) PutPageUpdate(ctx context.Context, containerName, blobName string, input PutPageUpdateInput) (result PutPageUpdateResponse, err error)

PutPageUpdate writes a range of pages to a page blob.

func (Client) ReleaseLease

func (c Client) ReleaseLease(ctx context.Context, containerName, blobName string, input ReleaseLeaseInput) (result ReleaseLeaseResponse, err error)

ReleaseLease releases a lock based on the Lease ID.

func (Client) RenewLease

func (c Client) RenewLease(ctx context.Context, containerName, blobName string, input RenewLeaseInput) (result RenewLeaseResponse, err error)

func (Client) SetMetaData

func (c Client) SetMetaData(ctx context.Context, containerName, blobName string, input SetMetaDataInput) (result SetMetaDataResponse, err error)

SetMetaData marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection.

func (Client) SetProperties

func (c Client) SetProperties(ctx context.Context, containerName, blobName string, input SetPropertiesInput) (result SetPropertiesResponse, err error)

SetProperties sets system properties on the blob.

func (Client) SetTier

func (c Client) SetTier(ctx context.Context, containerName, blobName string, input SetTierInput) (result SetTierResponse, err error)

SetTier sets the tier on a blob.

func (Client) Snapshot

func (c Client) Snapshot(ctx context.Context, containerName, blobName string, input SnapshotInput) (result SnapshotResponse, err error)

Snapshot captures a Snapshot of a given Blob

func (Client) Undelete

func (c Client) Undelete(ctx context.Context, containerName, blobName string) (result UndeleteResponse, err error)

Undelete restores the contents and metadata of soft deleted blob and any associated soft deleted snapshots.

type CommittedBlocks

type CommittedBlocks struct {
	Blocks []Block `xml:"Block"`
}

type CopyAbortResponse

type CopyAbortResponse struct {
	HttpResponse *http.Response
}

type CopyInput

type CopyInput struct {
	// Specifies the name of the source blob or file.
	// Beginning with version 2012-02-12, this value may be a URL of up to 2 KB in length that specifies a blob.
	// The value should be URL-encoded as it would appear in a request URI.
	// A source blob in the same storage account can be authenticated via Shared Key.
	// However, if the source is a blob in another account,
	// the source blob must either be public or must be authenticated via a shared access signature.
	// If the source blob is public, no authentication is required to perform the copy operation.
	//
	// Beginning with version 2015-02-21, the source object may be a file in the Azure File service.
	// If the source object is a file that is to be copied to a blob, then the source file must be authenticated
	// using a shared access signature, whether it resides in the same account or in a different account.
	//
	// Only storage accounts created on or after June 7th, 2012 allow the Copy Blob operation to
	// copy from another storage account.
	CopySource string

	// The ID of the Lease
	// Required if the destination blob has an active lease.
	// The lease ID specified for this header must match the lease ID of the destination blob.
	// If the request does not include the lease ID or it is not valid,
	// the operation fails with status code 412 (Precondition Failed).
	//
	// If this header is specified and the destination blob does not currently have an active lease,
	// the operation will also fail with status code 412 (Precondition Failed).
	LeaseID *string

	// The ID of the Lease on the Source Blob
	// Specify to perform the Copy Blob operation only if the lease ID matches the active lease ID of the source blob.
	SourceLeaseID *string

	// For page blobs on a premium account only. Specifies the tier to be set on the target blob
	AccessTier *AccessTier

	// A user-defined name-value pair associated with the blob.
	// If no name-value pairs are specified, the operation will copy the metadata from the source blob or
	// file to the destination blob.
	// If one or more name-value pairs are specified, the destination blob is created with the specified metadata,
	// and metadata is not copied from the source blob or file.
	MetaData map[string]string

	// An ETag value.
	// Specify an ETag value for this conditional header to copy the blob only if the specified
	// ETag value matches the ETag value for an existing destination blob.
	// If the ETag for the destination blob does not match the ETag specified for If-Match,
	// the Blob service returns status code 412 (Precondition Failed).
	IfMatch *string

	// An ETag value, or the wildcard character (*).
	// Specify an ETag value for this conditional header to copy the blob only if the specified
	// ETag value does not match the ETag value for the destination blob.
	// Specify the wildcard character (*) to perform the operation only if the destination blob does not exist.
	// If the specified condition isn't met, the Blob service returns status code 412 (Precondition Failed).
	IfNoneMatch *string

	// A DateTime value.
	// Specify this conditional header to copy the blob only if the destination blob
	// has been modified since the specified date/time.
	// If the destination blob has not been modified, the Blob service returns status code 412 (Precondition Failed).
	IfModifiedSince *string

	// A DateTime value.
	// Specify this conditional header to copy the blob only if the destination blob
	// has not been modified since the specified date/time.
	// If the destination blob has been modified, the Blob service returns status code 412 (Precondition Failed).
	IfUnmodifiedSince *string

	// An ETag value.
	// Specify this conditional header to copy the source blob only if its ETag matches the value specified.
	// If the ETag values do not match, the Blob service returns status code 412 (Precondition Failed).
	// This cannot be specified if the source is an Azure File.
	SourceIfMatch *string

	// An ETag value.
	// Specify this conditional header to copy the blob only if its ETag does not match the value specified.
	// If the values are identical, the Blob service returns status code 412 (Precondition Failed).
	// This cannot be specified if the source is an Azure File.
	SourceIfNoneMatch *string

	// A DateTime value.
	// Specify this conditional header to copy the blob only if the source blob has been modified
	// since the specified date/time.
	// If the source blob has not been modified, the Blob service returns status code 412 (Precondition Failed).
	// This cannot be specified if the source is an Azure File.
	SourceIfModifiedSince *string

	// A DateTime value.
	// Specify this conditional header to copy the blob only if the source blob has not been modified
	// since the specified date/time.
	// If the source blob has been modified, the Blob service returns status code 412 (Precondition Failed).
	// This header cannot be specified if the source is an Azure File.
	SourceIfUnmodifiedSince *string

	// The encryption scope to set for the request content.
	EncryptionScope *string
}

type CopyResponse

type CopyResponse struct {
	HttpResponse *http.Response

	CopyID     string
	CopyStatus string
}

type CopyStatus

type CopyStatus string
var (
	Aborted CopyStatus = "aborted"
	Failed  CopyStatus = "failed"
	Pending CopyStatus = "pending"
	Success CopyStatus = "success"
)

type DeleteInput

type DeleteInput struct {
	// Should any Snapshots for this Blob also be deleted?
	// If the Blob has Snapshots and this is set to False a 409 Conflict will be returned
	DeleteSnapshots bool

	// The ID of the Lease
	// This must be specified if a Lease is present on the Blob, else a 403 is returned
	LeaseID *string
}

type DeleteResponse

type DeleteResponse struct {
	HttpResponse *http.Response
}

type DeleteSnapshotInput

type DeleteSnapshotInput struct {
	// The ID of the Lease
	// This must be specified if a Lease is present on the Blob, else a 403 is returned
	LeaseID *string

	// The DateTime of the Snapshot which should be marked for Deletion
	SnapshotDateTime string
}

type DeleteSnapshotResponse

type DeleteSnapshotResponse struct {
	HttpResponse *http.Response
}

type DeleteSnapshotsInput

type DeleteSnapshotsInput struct {
	// The ID of the Lease
	// This must be specified if a Lease is present on the Blob, else a 403 is returned
	LeaseID *string
}

type DeleteSnapshotsResponse

type DeleteSnapshotsResponse struct {
	HttpResponse *http.Response
}

type GetBlockListInput

type GetBlockListInput struct {
	BlockListType BlockListType
	LeaseID       *string
}

type GetBlockListResponse

type GetBlockListResponse struct {
	HttpResponse *http.Response

	// The size of the blob in bytes
	BlobContentLength *int64

	// The Content Type of the blob
	ContentType string

	// The ETag associated with this blob
	ETag string

	// A list of blocks which have been committed
	CommittedBlocks CommittedBlocks `xml:"CommittedBlocks,omitempty"`

	// A list of blocks which have not yet been committed
	UncommittedBlocks UncommittedBlocks `xml:"UncommittedBlocks,omitempty"`
}

type GetInput

type GetInput struct {
	LeaseID   *string
	StartByte *int64
	EndByte   *int64
}

type GetPageRangesInput

type GetPageRangesInput struct {
	LeaseID *string

	StartByte *int64
	EndByte   *int64
}

type GetPageRangesResponse

type GetPageRangesResponse struct {
	HttpResponse *http.Response

	// The size of the blob in bytes
	ContentLength *int64

	// The Content Type of the blob
	ContentType string

	// The ETag associated with this blob
	ETag string

	PageRanges []PageRange `xml:"PageRange"`
}

type GetPropertiesInput

type GetPropertiesInput struct {
	// The ID of the Lease
	// This must be specified if a Lease is present on the Blob, else a 403 is returned
	LeaseID *string
}

type GetPropertiesResponse

type GetPropertiesResponse struct {
	HttpResponse *http.Response

	// The tier of page blob on a premium storage account or tier of block blob on blob storage or general purpose v2 account.
	AccessTier AccessTier

	// This gives the last time tier was changed on the object.
	// This header is returned only if tier on block blob was ever set.
	// The date format follows RFC 1123
	AccessTierChangeTime string

	// For page blobs on a premium storage account only.
	// If the access tier is not explicitly set on the blob, the tier is inferred based on its content length
	// and this header will be returned with true value.
	// For block blobs on Blob Storage or general purpose v2 account, if the blob does not have the access tier
	// set then we infer the tier from the storage account properties. This header is set only if the block blob
	// tier is inferred
	AccessTierInferred bool

	// For blob storage or general purpose v2 account.
	// If the blob is being rehydrated and is not complete then this header is returned indicating
	// that rehydrate is pending and also tells the destination tier
	ArchiveStatus ArchiveStatus

	// The number of committed blocks present in the blob.
	// This header is returned only for append blobs.
	BlobCommittedBlockCount string

	// The current sequence number for a page blob.
	// This header is not returned for block blobs or append blobs.
	// This header is not returned for block blobs.
	BlobSequenceNumber string

	// The blob type.
	BlobType BlobType

	// If the Cache-Control request header has previously been set for the blob, that value is returned in this header.
	CacheControl string

	// The Content-Disposition response header field conveys additional information about how to process
	// the response payload, and also can be used to attach additional metadata.
	// For example, if set to attachment, it indicates that the user-agent should not display the response,
	// but instead show a Save As dialog.
	ContentDisposition string

	// If the Content-Encoding request header has previously been set for the blob,
	// that value is returned in this header.
	ContentEncoding string

	// If the Content-Language request header has previously been set for the blob,
	// that value is returned in this header.
	ContentLanguage string

	// The size of the blob in bytes.
	// For a page blob, this header returns the value of the x-ms-blob-content-length header stored with the blob.
	ContentLength int64

	// The content type specified for the blob.
	// If no content type was specified, the default content type is `application/octet-stream`.
	ContentType string

	// If the Content-MD5 header has been set for the blob, this response header is returned so that
	// the client can check for message content integrity.
	ContentMD5 string

	// Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob.
	// This value can specify the time of a completed, aborted, or failed copy attempt.
	// This header does not appear if a copy is pending, if this blob has never been the
	// destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob
	// operation using Set Blob Properties, Put Blob, or Put Block List.
	CopyCompletionTime string

	// Included if the blob is incremental copy blob or incremental copy snapshot, if x-ms-copy-status is success.
	// Snapshot time of the last successful incremental copy snapshot for this blob
	CopyDestinationSnapshot string

	// String identifier for the last attempted Copy Blob operation where this blob was the destination blob.
	// This header does not appear if this blob has never been the destination in a Copy Blob operation,
	// or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties,
	// Put Blob, or Put Block List.
	CopyID string

	// Contains the number of bytes copied and the total bytes in the source in the last attempted
	// Copy Blob operation where this blob was the destination blob.
	// Can show between 0 and Content-Length bytes copied.
	// This header does not appear if this blob has never been the destination in a Copy Blob operation,
	// or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties,
	// Put Blob, or Put Block List.
	CopyProgress string

	// URL up to 2 KB in length that specifies the source blob used in the last attempted Copy Blob operation
	// where this blob was the destination blob.
	// This header does not appear if this blob has never been the destination in a Copy Blob operation,
	// or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties,
	// Put Blob, or Put Block List
	CopySource string

	// State of the copy operation identified by x-ms-copy-id, with these values:
	// - success: Copy completed successfully.
	// - pending: Copy is in progress.
	//            Check x-ms-copy-status-description if intermittent, non-fatal errors
	//            impede copy progress but don’t cause failure.
	// - aborted: Copy was ended by Abort Copy Blob.
	// - failed: Copy failed. See x-ms- copy-status-description for failure details.
	// This header does not appear if this blob has never been the destination in a Copy Blob operation,
	// or if this blob has been modified after a completed Copy Blob operation using Set Blob Properties,
	// Put Blob, or Put Block List.
	CopyStatus CopyStatus

	// Describes cause of fatal or non-fatal copy operation failure.
	// This header does not appear if this blob has never been the destination in a Copy Blob operation,
	// or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties,
	// Put Blob, or Put Block List.
	CopyStatusDescription string

	// The date/time at which the blob was created. The date format follows RFC 1123
	CreationTime string

	// The ETag contains a value that you can use to perform operations conditionally
	ETag string

	// Included if the blob is incremental copy blob.
	IncrementalCopy bool

	// The date/time that the blob was last modified. The date format follows RFC 1123.
	LastModified string

	// When a blob is leased, specifies whether the lease is of infinite or fixed duration
	LeaseDuration LeaseDuration

	// The lease state of the blob
	LeaseState LeaseState

	LeaseStatus LeaseStatus

	// A set of name-value pairs that correspond to the user-defined metadata associated with this blob
	MetaData map[string]string

	// Is the Storage Account encrypted using server-side encryption? This should always return true
	ServerEncrypted bool

	// The encryption scope for the request content.
	EncryptionScope string
}

type GetResponse

type GetResponse struct {
	HttpResponse *http.Response

	Contents *[]byte
}

type GetSnapshotPropertiesInput

type GetSnapshotPropertiesInput struct {
	// The ID of the Lease
	// This must be specified if a Lease is present on the Blob, else a 403 is returned
	LeaseID *string

	// The ID of the Snapshot which should be retrieved
	SnapshotID string
}

type IncrementalCopyBlob

type IncrementalCopyBlob struct {
	HttpResponse *http.Response
}

type IncrementalCopyBlobInput

type IncrementalCopyBlobInput struct {
	CopySource        string
	IfModifiedSince   *string
	IfUnmodifiedSince *string
	IfMatch           *string
	IfNoneMatch       *string
}

type LeaseDuration

type LeaseDuration string
var (
	Fixed    LeaseDuration = "fixed"
	Infinite LeaseDuration = "infinite"
)

type LeaseState

type LeaseState string
var (
	Available LeaseState = "available"
	Breaking  LeaseState = "breaking"
	Broken    LeaseState = "broken"
	Expired   LeaseState = "expired"
	Leased    LeaseState = "leased"
)

type LeaseStatus

type LeaseStatus string
var (
	Locked   LeaseStatus = "locked"
	Unlocked LeaseStatus = "unlocked"
)

type PageRange

type PageRange struct {
	// The start byte offset for this range, inclusive
	Start int64 `xml:"Start"`

	// The end byte offset for this range, inclusive
	End int64 `xml:"End"`
}

type PutAppendBlobInput

type PutAppendBlobInput struct {
	CacheControl       *string
	ContentDisposition *string
	ContentEncoding    *string
	ContentLanguage    *string
	ContentMD5         *string
	ContentType        *string
	LeaseID            *string
	EncryptionScope    *string
	MetaData           map[string]string
}

type PutAppendBlobResponse

type PutAppendBlobResponse struct {
	HttpResponse *http.Response
}

type PutBlockBlobInput

type PutBlockBlobInput struct {
	CacheControl       *string
	Content            *[]byte
	ContentDisposition *string
	ContentEncoding    *string
	ContentLanguage    *string
	ContentMD5         *string
	ContentType        *string
	LeaseID            *string
	EncryptionScope    *string
	MetaData           map[string]string
}

type PutBlockBlobResponse

type PutBlockBlobResponse struct {
	HttpResponse *http.Response
}

type PutBlockFromURLInput

type PutBlockFromURLInput struct {
	BlockID    string
	CopySource string

	ContentMD5      *string
	LeaseID         *string
	Range           *string
	EncryptionScope *string
}

type PutBlockFromURLResponse

type PutBlockFromURLResponse struct {
	ContentMD5   string
	HttpResponse *http.Response
}

type PutBlockInput

type PutBlockInput struct {
	BlockID         string
	Content         []byte
	ContentMD5      *string
	LeaseID         *string
	EncryptionScope *string
}

type PutBlockListInput

type PutBlockListInput struct {
	BlockList          BlockList
	CacheControl       *string
	ContentDisposition *string
	ContentEncoding    *string
	ContentLanguage    *string
	ContentMD5         *string
	ContentType        *string
	LeaseID            *string
	EncryptionScope    *string
	MetaData           map[string]string
}

type PutBlockListResponse

type PutBlockListResponse struct {
	HttpResponse *http.Response

	ContentMD5   string
	ETag         string
	LastModified string
}

type PutBlockResponse

type PutBlockResponse struct {
	HttpResponse *http.Response
	ContentMD5   string
}

type PutPageBlobInput

type PutPageBlobInput struct {
	CacheControl       *string
	ContentDisposition *string
	ContentEncoding    *string
	ContentLanguage    *string
	ContentMD5         *string
	ContentType        *string
	LeaseID            *string
	EncryptionScope    *string
	MetaData           map[string]string

	BlobContentLengthBytes int64
	BlobSequenceNumber     *int64
	AccessTier             *AccessTier
}

type PutPageBlobResponse

type PutPageBlobResponse struct {
	HttpResponse *http.Response
}

type PutPageClearInput

type PutPageClearInput struct {
	StartByte int64
	EndByte   int64

	LeaseID         *string
	EncryptionScope *string
}

type PutPageClearResponse

type PutPageClearResponse struct {
	HttpResponse *http.Response
}

type PutPageUpdateInput

type PutPageUpdateInput struct {
	StartByte int64
	EndByte   int64
	Content   []byte

	IfSequenceNumberEQ *string
	IfSequenceNumberLE *string
	IfSequenceNumberLT *string
	IfModifiedSince    *string
	IfUnmodifiedSince  *string
	IfMatch            *string
	IfNoneMatch        *string
	LeaseID            *string
	EncryptionScope    *string
}

type PutPageUpdateResponse

type PutPageUpdateResponse struct {
	HttpResponse *http.Response

	BlobSequenceNumber string
	ContentMD5         string
	LastModified       string
}

type ReleaseLeaseInput

type ReleaseLeaseInput struct {
	LeaseID string
}

type ReleaseLeaseResponse

type ReleaseLeaseResponse struct {
	HttpResponse *http.Response
}

type RenewLeaseInput

type RenewLeaseInput struct {
	LeaseID string
}

type RenewLeaseResponse

type RenewLeaseResponse struct {
	HttpResponse *http.Response
}

type SequenceNumberAction

type SequenceNumberAction string
var (
	Increment SequenceNumberAction = "increment"
	Max       SequenceNumberAction = "max"
	Update    SequenceNumberAction = "update"
)

type SetMetaDataInput

type SetMetaDataInput struct {
	// The ID of the Lease
	// This must be specified if a Lease is present on the Blob, else a 403 is returned
	LeaseID *string

	// Any metadata which should be added to this blob
	MetaData map[string]string

	// The encryption scope for the blob.
	EncryptionScope *string
}

type SetMetaDataResponse

type SetMetaDataResponse struct {
	HttpResponse *http.Response
}

type SetPropertiesInput

type SetPropertiesInput struct {
	CacheControl         *string
	ContentType          *string
	ContentMD5           *string
	ContentEncoding      *string
	ContentLanguage      *string
	LeaseID              *string
	ContentDisposition   *string
	ContentLength        *int64
	SequenceNumberAction *SequenceNumberAction
	BlobSequenceNumber   *string
}

type SetPropertiesResponse

type SetPropertiesResponse struct {
	HttpResponse *http.Response

	BlobSequenceNumber string
	Etag               string
}

type SetTierInput

type SetTierInput struct {
	Tier AccessTier
}

type SetTierResponse

type SetTierResponse struct {
	HttpResponse *http.Response
}

type SnapshotInput

type SnapshotInput struct {
	// The ID of the Lease
	// This must be specified if a Lease is present on the Blob, else a 403 is returned
	LeaseID *string

	// The encryption scope to set for the request content.
	EncryptionScope *string

	// MetaData is a user-defined name-value pair associated with the blob.
	// If no name-value pairs are specified, the operation will copy the base blob metadata to the snapshot.
	// If one or more name-value pairs are specified, the snapshot is created with the specified metadata,
	// and metadata is not copied from the base blob.
	MetaData map[string]string

	// A DateTime value which will only snapshot the blob if it has been modified since the specified date/time
	// If the base blob has not been modified, the Blob service returns status code 412 (Precondition Failed).
	IfModifiedSince *string

	// A DateTime value which will only snapshot the blob if it has not been modified since the specified date/time
	// If the base blob has been modified, the Blob service returns status code 412 (Precondition Failed).
	IfUnmodifiedSince *string

	// An ETag value to snapshot the blob only if its ETag value matches the value specified.
	// If the values do not match, the Blob service returns status code 412 (Precondition Failed).
	IfMatch *string

	// An ETag value for this conditional header to snapshot the blob only if its ETag value
	// does not match the value specified.
	// If the values are identical, the Blob service returns status code 412 (Precondition Failed).
	IfNoneMatch *string
}

type SnapshotResponse

type SnapshotResponse struct {
	HttpResponse *http.Response

	// The ETag of the snapshot
	ETag string

	// A DateTime value that uniquely identifies the snapshot.
	// The value of this header indicates the snapshot version,
	// and may be used in subsequent requests to access the snapshot.
	SnapshotDateTime string
}

type StorageBlob

type StorageBlob interface {
	AppendBlock(ctx context.Context, containerName string, blobName string, input AppendBlockInput) (AppendBlockResponse, error)
	Copy(ctx context.Context, containerName string, blobName string, input CopyInput) (CopyResponse, error)
	AbortCopy(ctx context.Context, containerName string, blobName string, input AbortCopyInput) (CopyAbortResponse, error)
	CopyAndWait(ctx context.Context, containerName string, blobName string, input CopyInput) error
	Delete(ctx context.Context, containerName string, blobName string, input DeleteInput) (DeleteResponse, error)
	DeleteSnapshot(ctx context.Context, containerName string, blobName string, input DeleteSnapshotInput) (DeleteSnapshotResponse, error)
	DeleteSnapshots(ctx context.Context, containerName string, blobName string, input DeleteSnapshotsInput) (DeleteSnapshotsResponse, error)
	Get(ctx context.Context, containerName string, blobName string, input GetInput) (GetResponse, error)
	GetBlockList(ctx context.Context, containerName string, blobName string, input GetBlockListInput) (GetBlockListResponse, error)
	GetPageRanges(ctx context.Context, containerName, blobName string, input GetPageRangesInput) (GetPageRangesResponse, error)
	IncrementalCopyBlob(ctx context.Context, containerName string, blobName string, input IncrementalCopyBlobInput) (IncrementalCopyBlob, error)
	AcquireLease(ctx context.Context, containerName string, blobName string, input AcquireLeaseInput) (AcquireLeaseResponse, error)
	BreakLease(ctx context.Context, containerName string, blobName string, input BreakLeaseInput) (BreakLeaseResponse, error)
	ChangeLease(ctx context.Context, containerName string, blobName string, input ChangeLeaseInput) (ChangeLeaseResponse, error)
	ReleaseLease(ctx context.Context, containerName string, blobName string, input ReleaseLeaseInput) (ReleaseLeaseResponse, error)
	RenewLease(ctx context.Context, containerName string, blobName string, input RenewLeaseInput) (RenewLeaseResponse, error)
	SetMetaData(ctx context.Context, containerName string, blobName string, input SetMetaDataInput) (SetMetaDataResponse, error)
	GetProperties(ctx context.Context, containerName string, blobName string, input GetPropertiesInput) (GetPropertiesResponse, error)
	SetProperties(ctx context.Context, containerName string, blobName string, input SetPropertiesInput) (SetPropertiesResponse, error)
	PutAppendBlob(ctx context.Context, containerName string, blobName string, input PutAppendBlobInput) (PutAppendBlobResponse, error)
	PutBlock(ctx context.Context, containerName string, blobName string, input PutBlockInput) (PutBlockResponse, error)
	PutBlockBlob(ctx context.Context, containerName string, blobName string, input PutBlockBlobInput) (PutBlockBlobResponse, error)
	PutBlockBlobFromFile(ctx context.Context, containerName string, blobName string, file *os.File, input PutBlockBlobInput) error
	PutBlockList(ctx context.Context, containerName string, blobName string, input PutBlockListInput) (PutBlockListResponse, error)
	PutBlockFromURL(ctx context.Context, containerName string, blobName string, input PutBlockFromURLInput) (PutBlockFromURLResponse, error)
	PutPageBlob(ctx context.Context, containerName string, blobName string, input PutPageBlobInput) (PutPageBlobResponse, error)
	PutPageClear(ctx context.Context, containerName string, blobName string, input PutPageClearInput) (PutPageClearResponse, error)
	PutPageUpdate(ctx context.Context, containerName string, blobName string, input PutPageUpdateInput) (PutPageUpdateResponse, error)
	SetTier(ctx context.Context, containerName string, blobName string, input SetTierInput) (SetTierResponse, error)
	Snapshot(ctx context.Context, containerName string, blobName string, input SnapshotInput) (SnapshotResponse, error)
	GetSnapshotProperties(ctx context.Context, containerName string, blobName string, input GetSnapshotPropertiesInput) (GetPropertiesResponse, error)
	Undelete(ctx context.Context, containerName string, blobName string) (UndeleteResponse, error)
}

type UncommittedBlocks

type UncommittedBlocks struct {
	Blocks []Block `xml:"Block"`
}

type UndeleteResponse

type UndeleteResponse struct {
	HttpResponse *http.Response
}

Jump to

Keyboard shortcuts

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