package azblob
import "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
Example¶
This example shows you how to get started using the Azure Storage Blob SDK for Go.
Code:
{ // Use your storage account's name and key to create a credential object, used to access your account. // You can obtain these details from the Azure Portal. accountName, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_NAME") if !ok { panic("AZURE_STORAGE_ACCOUNT_NAME could not be found") } accountKey, ok := os.LookupEnv("AZURE_STORAGE_PRIMARY_ACCOUNT_KEY") if !ok { panic("AZURE_STORAGE_PRIMARY_ACCOUNT_KEY could not be found") } cred, err := NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } // Open up a service client. // You'll need to specify a service URL, which for blob endpoints usually makes up the syntax http(s)://<account>.blob.core.windows.net/ service, err := NewServiceClient("https://"+accountName+".blob.core.windows.net/", cred, nil) if err != nil { log.Fatal(err) } // All operations in the Azure Storage Blob SDK for Go operate on a context.Context, allowing you to control cancellation/timeout. ctx := context.Background() // This example has no expiry. // This example showcases several common operations to help you get started, such as: // ===== 1. Creating a container ===== // First, branch off of the service client and create a container client. container := service.NewContainerClient("myContainer") // Then, fire off a create operation on the container client. // Note that, all service-side requests have an options bag attached, allowing you to specify things like metadata, public access types, etc. // Specifying nil omits all options. _, err = container.Create(ctx, nil) if err != nil { log.Fatal(err) } // ===== 2. Uploading/downloading a block blob ===== // We'll specify our data up-front, rather than reading a file for simplicity's sake. data := "Hello world!" // Branch off of the container into a block blob client blockBlob := container.NewBlockBlobClient("HelloWorld.txt") // Upload data to the block blob _, err = blockBlob.Upload(ctx, NopCloser(strings.NewReader(data)), nil) if err != nil { log.Fatal(err) } // Download the blob's contents and ensure that the download worked properly get, err := blockBlob.Download(ctx, nil) if err != nil { log.Fatal(err) } // Open a buffer, reader, and then download! downloadedData := &bytes.Buffer{} reader := get.Body(RetryReaderOptions{}) // RetryReaderOptions has a lot of in-depth tuning abilities, but for the sake of simplicity, we'll omit those here. _, err = downloadedData.ReadFrom(reader) if err != nil { return } err = reader.Close() if err != nil { return } if data != downloadedData.String() { log.Fatal("downloaded data doesn't match uploaded data") } // ===== 3. list blobs ===== // The ListBlobs and ListContainers APIs return two channels, a values channel, and an errors channel. // You should enumerate on a range over the values channel, and then check the errors channel, as only ONE value will ever be passed to the errors channel. // The AutoPagerTimeout defines how long it will wait to place into the items channel before it exits & cleans itself up. A zero time will result in no timeout. pager := container.ListBlobsFlat(nil) for pager.NextPage(ctx) { resp := pager.PageResponse() for _, v := range resp.ContainerListBlobFlatSegmentResult.Segment.BlobItems { fmt.Println(*v.Name) } } if err = pager.Err(); err != nil { log.Fatal(err) } // Delete the blob we created earlier. _, err = blockBlob.Delete(ctx, nil) if err != nil { log.Fatal(err) } // Delete the container we created earlier. _, err = container.Delete(ctx, nil) if err != nil { log.Fatal(err) } }
Example (BlobSnapshots)¶
This example show how to create a blob, take a snapshot of it, update the base blob, read from the blob snapshot, list blobs with their snapshots, and hot to delete blob snapshots.
Code:
{ // From the Azure portal, get your Storage account blob service URL endpoint. accountName, accountKey := accountInfo() // Create a ContainerClient object to a container where we'll create a blob and its snapshot. u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer", accountName) credential, err := NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } containerClient, err := NewContainerClient(u, credential, nil) if err != nil { log.Fatal(err) } // Create a BlockBlobClient object to a blob in the container. baseBlobClient := containerClient.NewBlockBlobClient("Original.txt") ctx := context.Background() // This example uses a never-expiring context // Create the original blob: _, err = baseBlobClient.Upload(ctx, NopCloser(NopCloser(strings.NewReader("Some text"))), nil) if err != nil { log.Fatal(err) } // Create a snapshot of the original blob & save its timestamp: createSnapshot, err := baseBlobClient.CreateSnapshot(ctx, nil) if err != nil { log.Fatal(err) } snapshot := *createSnapshot.Snapshot // Modify the original blob & show it: _, err = baseBlobClient.Upload(ctx, NopCloser(strings.NewReader("New text")), nil) if err != nil { log.Fatal(err) } get, err := baseBlobClient.Download(ctx, nil) if err != nil { log.Fatal(err) } b := bytes.Buffer{} reader := get.Body(RetryReaderOptions{}) _, err = b.ReadFrom(reader) if err != nil { return } err = reader.Close() if err != nil { return } // The client must close the response body when finished with it fmt.Println(b.String()) // Show snapshot blob via original blob URI & snapshot time: snapshotBlobClient := baseBlobClient.WithSnapshot(snapshot) get, err = snapshotBlobClient.Download(ctx, nil) if err != nil { log.Fatal(err) } b.Reset() reader = get.Body(RetryReaderOptions{}) _, err = b.ReadFrom(reader) if err != nil { return } err = reader.Close() if err != nil { return } // The client must close the response body when finished with it fmt.Println(b.String()) // FYI: You can get the base blob URL from one of its snapshot by passing "" to WithSnapshot: baseBlobClient = snapshotBlobClient.WithSnapshot("") // Show all blobs in the container with their snapshots: // List the blob(s) in our container; since a container may hold millions of blobs, this is done 1 segment at a time. pager := containerClient.ListBlobsFlat(nil) for pager.NextPage(ctx) { resp := pager.PageResponse() for _, blob := range resp.ContainerListBlobFlatSegmentResult.Segment.BlobItems { // Process the blobs returned snapTime := "N/A" if blob.Snapshot != nil { snapTime = *blob.Snapshot } fmt.Printf("Blob name: %s, Snapshot: %s\n", *blob.Name, snapTime) } } if err := pager.Err(); err != nil { log.Fatal(err) } // Promote read-only snapshot to writable base blob: _, err = baseBlobClient.StartCopyFromURL(ctx, snapshotBlobClient.URL(), nil) if err != nil { log.Fatal(err) } // When calling Delete on a base blob: // DeleteSnapshotsOptionOnly deletes all the base blob's snapshots but not the base blob itself // DeleteSnapshotsOptionInclude deletes the base blob & all its snapshots. // DeleteSnapshotOptionNone produces an error if the base blob has any snapshots. _, err = baseBlobClient.Delete(ctx, &DeleteBlobOptions{DeleteSnapshots: DeleteSnapshotsOptionTypeInclude.ToPtr()}) if err != nil { log.Fatal(err) } }
Example (ProgressUploadDownload)¶
Code:
{ // Create a credentials object with your Azure Storage Account name and key. accountName, accountKey := accountInfo() credential, err := NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } // From the Azure portal, get your Storage account blob service URL endpoint. cURL := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer", accountName) // Create an serviceClient object that wraps the service URL and a request pipeline to making requests. containerClient, err := NewContainerClient(cURL, credential, nil) if err != nil { log.Fatal(err) } ctx := context.Background() // This example uses a never-expiring context // Here's how to create a blob with HTTP headers and metadata (I'm using the same metadata that was put on the container): blobClient := containerClient.NewBlockBlobClient("Data.bin") // requestBody is the stream of data to write requestBody := NopCloser(strings.NewReader("Some text to write")) // Wrap the request body in a RequestBodyProgress and pass a callback function for progress reporting. _, err = blobClient.Upload(ctx, streaming.NewRequestProgress(NopCloser(requestBody), func(bytesTransferred int64) { fmt.Printf("Wrote %d of %d bytes.", bytesTransferred, requestBody) }), &UploadBlockBlobOptions{HTTPHeaders: &BlobHTTPHeaders{ BlobContentType: to.StringPtr("text/html; charset=utf-8"), BlobContentDisposition: to.StringPtr("attachment"), }}) if err != nil { log.Fatal(err) } // Here's how to read the blob's data with progress reporting: get, err := blobClient.Download(ctx, nil) if err != nil { log.Fatal(err) } // Wrap the response body in a ResponseBodyProgress and pass a callback function for progress reporting. responseBody := streaming.NewResponseProgress(get.Body(RetryReaderOptions{}), func(bytesTransferred int64) { fmt.Printf("Read %d of %d bytes.", bytesTransferred, *get.ContentLength) }) downloadedData := &bytes.Buffer{} _, err = downloadedData.ReadFrom(responseBody) if err != nil { return } err = responseBody.Close() if err != nil { return } // The client must close the response body when finished with it // The downloaded blob data is in downloadData's buffer }
Index ¶
- Constants
- Variables
- func DoBatchTransfer(ctx context.Context, o BatchTransferOptions) error
- func FormatTimesForSASSigning(startTime, expiryTime, snapshotTime time.Time) (string, string, string)
- func NewRetryReader(ctx context.Context, initialResponse *http.Response, info HTTPGetterInfo, o RetryReaderOptions, getter HTTPGetter) io.ReadCloser
- type AbortCopyBlobOptions
- type AccessPolicy
- func (a AccessPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (a *AccessPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type AccessPolicyPermission
- func (p *AccessPolicyPermission) Parse(s string) error
- func (p AccessPolicyPermission) String() string
- type AccessTier
- type AccountKind
- type AccountSASPermissions
- func (p *AccountSASPermissions) Parse(s string) error
- func (p AccountSASPermissions) String() string
- type AccountSASResourceTypes
- func (rt *AccountSASResourceTypes) Parse(s string) error
- func (rt AccountSASResourceTypes) String() string
- type AccountSASServices
- type AccountSASSignatureValues
- type AcquireLeaseBlobOptions
- type AcquireLeaseContainerOptions
- type AppendBlobAppendBlockFromURLOptions
- type AppendBlobAppendBlockFromURLResponse
- type AppendBlobAppendBlockFromURLResult
- type AppendBlobAppendBlockOptions
- type AppendBlobAppendBlockResponse
- type AppendBlobAppendBlockResult
- type AppendBlobClient
- func NewAppendBlobClient(blobURL string, cred azcore.Credential, options *ClientOptions) (AppendBlobClient, error)
- func (ab AppendBlobClient) AppendBlock(ctx context.Context, body io.ReadSeekCloser, options *AppendBlockOptions) (AppendBlobAppendBlockResponse, error)
- func (ab AppendBlobClient) AppendBlockFromURL(ctx context.Context, source string, options *AppendBlockURLOptions) (AppendBlobAppendBlockFromURLResponse, error)
- func (ab AppendBlobClient) Create(ctx context.Context, options *CreateAppendBlobOptions) (AppendBlobCreateResponse, error)
- func (ab AppendBlobClient) SealAppendBlob(ctx context.Context, options *SealAppendBlobOptions) (AppendBlobSealResponse, error)
- func (ab AppendBlobClient) WithSnapshot(snapshot string) AppendBlobClient
- func (ab AppendBlobClient) WithVersionID(versionID string) AppendBlobClient
- type AppendBlobCreateOptions
- type AppendBlobCreateResponse
- type AppendBlobCreateResult
- type AppendBlobSealOptions
- type AppendBlobSealResponse
- type AppendBlobSealResult
- type AppendBlockOptions
- type AppendBlockURLOptions
- type AppendPositionAccessConditions
- type ArchiveStatus
- type BatchTransferOptions
- type BlobAbortCopyFromURLOptions
- type BlobAbortCopyFromURLResponse
- type BlobAbortCopyFromURLResult
- type BlobAccessConditions
- type BlobAcquireLeaseOptions
- type BlobAcquireLeaseResponse
- type BlobAcquireLeaseResult
- type BlobBreakLeaseOptions
- type BlobBreakLeaseResponse
- type BlobBreakLeaseResult
- type BlobChangeLeaseOptions
- type BlobChangeLeaseResponse
- type BlobChangeLeaseResult
- type BlobClient
- func NewBlobClient(blobURL string, cred azcore.Credential, options *ClientOptions) (BlobClient, error)
- func NewBlobClientFromConnectionString(connectionString, containerName, blobName string, options *ClientOptions) (BlobClient, error)
- func (b BlobClient) AbortCopyFromURL(ctx context.Context, copyID string, options *AbortCopyBlobOptions) (BlobAbortCopyFromURLResponse, error)
- func (b BlobClient) CreateSnapshot(ctx context.Context, options *CreateBlobSnapshotOptions) (BlobCreateSnapshotResponse, error)
- func (b BlobClient) Delete(ctx context.Context, options *DeleteBlobOptions) (BlobDeleteResponse, error)
- func (b BlobClient) Download(ctx context.Context, options *DownloadBlobOptions) (*DownloadResponse, error)
- func (b BlobClient) DownloadBlobToBuffer(ctx context.Context, offset int64, count int64, _bytes []byte, o HighLevelDownloadFromBlobOptions) error
- func (b BlobClient) DownloadBlobToFile(ctx context.Context, offset int64, count int64, file *os.File, o HighLevelDownloadFromBlobOptions) error
- func (b BlobClient) GetProperties(ctx context.Context, options *GetBlobPropertiesOptions) (GetBlobPropertiesResponse, error)
- func (b BlobClient) GetSASToken(permissions BlobSASPermissions, start time.Time, expiry time.Time) (SASQueryParameters, error)
- func (b BlobClient) GetTags(ctx context.Context, options *GetTagsBlobOptions) (BlobGetTagsResponse, error)
- func (b BlobClient) NewBlobLeaseClient(leaseID *string) (BlobLeaseClient, error)
- func (b BlobClient) SetHTTPHeaders(ctx context.Context, blobHttpHeaders BlobHTTPHeaders, options *SetBlobHTTPHeadersOptions) (BlobSetHTTPHeadersResponse, error)
- func (b BlobClient) SetMetadata(ctx context.Context, metadata map[string]string, options *SetBlobMetadataOptions) (BlobSetMetadataResponse, error)
- func (b BlobClient) SetTags(ctx context.Context, options *SetTagsBlobOptions) (BlobSetTagsResponse, error)
- func (b BlobClient) SetTier(ctx context.Context, tier AccessTier, options *SetTierOptions) (BlobSetTierResponse, error)
- func (b BlobClient) StartCopyFromURL(ctx context.Context, copySource string, options *StartCopyBlobOptions) (BlobStartCopyFromURLResponse, error)
- func (b BlobClient) URL() string
- func (b BlobClient) Undelete(ctx context.Context) (BlobUndeleteResponse, error)
- func (b BlobClient) WithSnapshot(snapshot string) BlobClient
- func (b BlobClient) WithVersionID(versionID string) BlockBlobClient
- type BlobCopyFromURLOptions
- type BlobCopyFromURLResponse
- type BlobCopyFromURLResult
- type BlobCreateSnapshotOptions
- type BlobCreateSnapshotResponse
- type BlobCreateSnapshotResult
- type BlobDeleteOptions
- type BlobDeleteResponse
- type BlobDeleteResult
- type BlobDownloadOptions
- type BlobDownloadResponse
- type BlobDownloadResult
- type BlobExpiryOptions
- func PossibleBlobExpiryOptionsValues() []BlobExpiryOptions
- func (c BlobExpiryOptions) ToPtr() *BlobExpiryOptions
- type BlobFlatListSegment
- type BlobGetAccessControlOptions
- type BlobGetAccessControlResponse
- type BlobGetAccessControlResult
- type BlobGetAccountInfoOptions
- type BlobGetAccountInfoResponse
- type BlobGetAccountInfoResult
- type BlobGetPropertiesOptions
- type BlobGetPropertiesResponse
- type BlobGetPropertiesResult
- type BlobGetTagsOptions
- type BlobGetTagsResponse
- type BlobGetTagsResult
- type BlobHTTPHeaders
- type BlobHierarchyListSegment
- type BlobItemInternal
- type BlobLeaseClient
- func (blc *BlobLeaseClient) AcquireLease(ctx context.Context, options *AcquireLeaseBlobOptions) (BlobAcquireLeaseResponse, error)
- func (blc *BlobLeaseClient) BreakLease(ctx context.Context, options *BreakLeaseBlobOptions) (BlobBreakLeaseResponse, error)
- func (blc *BlobLeaseClient) ChangeLease(ctx context.Context, options *ChangeLeaseBlobOptions) (BlobChangeLeaseResponse, error)
- func (blc *BlobLeaseClient) ReleaseLease(ctx context.Context, options *ReleaseLeaseBlobOptions) (BlobReleaseLeaseResponse, error)
- func (blc *BlobLeaseClient) RenewLease(ctx context.Context, options *RenewLeaseBlobOptions) (BlobRenewLeaseResponse, error)
- type BlobMetadata
- type BlobPrefix
- type BlobPropertiesInternal
- func (b BlobPropertiesInternal) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (b *BlobPropertiesInternal) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type BlobQueryOptions
- type BlobQueryResponse
- type BlobQueryResult
- type BlobReleaseLeaseOptions
- type BlobReleaseLeaseResponse
- type BlobReleaseLeaseResult
- type BlobRenameOptions
- type BlobRenameResponse
- type BlobRenameResult
- type BlobRenewLeaseOptions
- type BlobRenewLeaseResponse
- type BlobRenewLeaseResult
- type BlobSASPermissions
- type BlobSASSignatureValues
- type BlobSetAccessControlOptions
- type BlobSetAccessControlResponse
- type BlobSetAccessControlResult
- type BlobSetExpiryOptions
- type BlobSetExpiryResponse
- type BlobSetExpiryResult
- type BlobSetHTTPHeadersOptions
- type BlobSetHTTPHeadersResponse
- type BlobSetHTTPHeadersResult
- type BlobSetMetadataOptions
- type BlobSetMetadataResponse
- type BlobSetMetadataResult
- type BlobSetTagsOptions
- type BlobSetTagsResponse
- type BlobSetTagsResult
- type BlobSetTierOptions
- type BlobSetTierResponse
- type BlobSetTierResult
- type BlobStartCopyFromURLOptions
- type BlobStartCopyFromURLResponse
- type BlobStartCopyFromURLResult
- type BlobTag
- type BlobTags
- type BlobType
- type BlobURLParts
- type BlobUndeleteOptions
- type BlobUndeleteResponse
- type BlobUndeleteResult
- type Block
- type BlockBlobClient
- func NewBlockBlobClient(blobURL string, cred azcore.Credential, options *ClientOptions) (BlockBlobClient, error)
- func (bb BlockBlobClient) CommitBlockList(ctx context.Context, base64BlockIDs []string, options *CommitBlockListOptions) (BlockBlobCommitBlockListResponse, error)
- func (bb BlockBlobClient) CopyFromURL(ctx context.Context, source string, options *CopyBlockBlobFromURLOptions) (BlobCopyFromURLResponse, error)
- func (bb BlockBlobClient) GetBlockList(ctx context.Context, listType BlockListType, options *GetBlockListOptions) (BlockBlobGetBlockListResponse, error)
- func (bb BlockBlobClient) StageBlock(ctx context.Context, base64BlockID string, body io.ReadSeekCloser, options *StageBlockOptions) (BlockBlobStageBlockResponse, error)
- func (bb BlockBlobClient) StageBlockFromURL(ctx context.Context, base64BlockID string, sourceURL string, contentLength int64, options *StageBlockFromURLOptions) (BlockBlobStageBlockFromURLResponse, error)
- func (bb BlockBlobClient) Upload(ctx context.Context, body io.ReadSeekCloser, options *UploadBlockBlobOptions) (BlockBlobUploadResponse, error)
- func (bb BlockBlobClient) UploadBufferToBlockBlob(ctx context.Context, b []byte, o HighLevelUploadToBlockBlobOption) (*http.Response, error)
- func (bb BlockBlobClient) UploadFileToBlockBlob(ctx context.Context, file *os.File, o HighLevelUploadToBlockBlobOption) (*http.Response, error)
- func (bb BlockBlobClient) UploadStreamToBlockBlob(ctx context.Context, body io.ReadSeekCloser, o UploadStreamToBlockBlobOptions) (BlockBlobCommitBlockListResponse, error)
- func (bb BlockBlobClient) WithSnapshot(snapshot string) BlockBlobClient
- func (bb BlockBlobClient) WithVersionID(versionID string) BlockBlobClient
- type BlockBlobCommitBlockListOptions
- type BlockBlobCommitBlockListResponse
- type BlockBlobCommitBlockListResult
- type BlockBlobGetBlockListOptions
- type BlockBlobGetBlockListResponse
- type BlockBlobGetBlockListResult
- type BlockBlobStageBlockFromURLOptions
- type BlockBlobStageBlockFromURLResponse
- type BlockBlobStageBlockFromURLResult
- type BlockBlobStageBlockOptions
- type BlockBlobStageBlockResponse
- type BlockBlobStageBlockResult
- type BlockBlobUploadOptions
- type BlockBlobUploadResponse
- type BlockBlobUploadResult
- type BlockList
- type BlockListType
- type BlockLookupList
- type BreakLeaseBlobOptions
- type BreakLeaseContainerOptions
- type ChangeLeaseBlobOptions
- type ChangeLeaseContainerOptions
- type ClearPagesOptions
- type ClearRange
- type ClientOptions
- type CommitBlockListOptions
- type ContainerAccessConditions
- type ContainerAcquireLeaseOptions
- type ContainerAcquireLeaseResponse
- type ContainerAcquireLeaseResult
- type ContainerBreakLeaseOptions
- type ContainerBreakLeaseResponse
- type ContainerBreakLeaseResult
- type ContainerChangeLeaseOptions
- type ContainerChangeLeaseResponse
- type ContainerChangeLeaseResult
- type ContainerClient
- func NewContainerClient(containerURL string, cred azcore.Credential, options *ClientOptions) (ContainerClient, error)
- func NewContainerClientFromConnectionString(connectionString string, containerName string, options *ClientOptions) (ContainerClient, error)
- func (c ContainerClient) Create(ctx context.Context, options *CreateContainerOptions) (ContainerCreateResponse, error)
- func (c ContainerClient) Delete(ctx context.Context, options *DeleteContainerOptions) (ContainerDeleteResponse, error)
- func (c ContainerClient) GetAccessPolicy(ctx context.Context, options *GetAccessPolicyOptions) (ContainerGetAccessPolicyResponse, error)
- func (c ContainerClient) GetProperties(ctx context.Context, gpo *GetPropertiesOptionsContainer) (ContainerGetPropertiesResponse, error)
- func (c ContainerClient) GetSASToken(permissions BlobSASPermissions, start time.Time, expiry time.Time) (SASQueryParameters, error)
- func (c ContainerClient) ListBlobsFlat(listOptions *ContainerListBlobFlatSegmentOptions) *ContainerListBlobFlatSegmentPager
- func (c ContainerClient) ListBlobsHierarchy(delimiter string, listOptions *ContainerListBlobHierarchySegmentOptions) *ContainerListBlobHierarchySegmentPager
- func (c ContainerClient) NewAppendBlobClient(blobName string) AppendBlobClient
- func (c ContainerClient) NewBlobClient(blobName string) BlobClient
- func (c ContainerClient) NewBlockBlobClient(blobName string) BlockBlobClient
- func (c ContainerClient) NewContainerLeaseClient(leaseID *string) (ContainerLeaseClient, error)
- func (c ContainerClient) NewPageBlobClient(blobName string) PageBlobClient
- func (c ContainerClient) SetAccessPolicy(ctx context.Context, options *SetAccessPolicyOptions) (ContainerSetAccessPolicyResponse, error)
- func (c ContainerClient) SetMetadata(ctx context.Context, options *SetMetadataContainerOptions) (ContainerSetMetadataResponse, error)
- func (c ContainerClient) URL() string
- type ContainerCpkScopeInfo
- type ContainerCreateOptions
- type ContainerCreateResponse
- type ContainerCreateResult
- type ContainerDeleteOptions
- type ContainerDeleteResponse
- type ContainerDeleteResult
- type ContainerGetAccessPolicyOptions
- type ContainerGetAccessPolicyResponse
- type ContainerGetAccessPolicyResult
- type ContainerGetAccountInfoOptions
- type ContainerGetAccountInfoResponse
- type ContainerGetAccountInfoResult
- type ContainerGetPropertiesOptions
- type ContainerGetPropertiesResponse
- type ContainerGetPropertiesResult
- type ContainerItem
- type ContainerLeaseClient
- func (clc *ContainerLeaseClient) AcquireLease(ctx context.Context, options *AcquireLeaseContainerOptions) (ContainerAcquireLeaseResponse, error)
- func (clc *ContainerLeaseClient) BreakLease(ctx context.Context, options *BreakLeaseContainerOptions) (ContainerBreakLeaseResponse, error)
- func (clc *ContainerLeaseClient) ChangeLease(ctx context.Context, options *ChangeLeaseContainerOptions) (ContainerChangeLeaseResponse, error)
- func (clc *ContainerLeaseClient) ReleaseLease(ctx context.Context, options *ReleaseLeaseContainerOptions) (ContainerReleaseLeaseResponse, error)
- func (clc *ContainerLeaseClient) RenewLease(ctx context.Context, options *RenewLeaseContainerOptions) (ContainerRenewLeaseResponse, error)
- type ContainerListBlobFlatSegmentOptions
- type ContainerListBlobFlatSegmentPager
- func (p *ContainerListBlobFlatSegmentPager) Err() error
- func (p *ContainerListBlobFlatSegmentPager) NextPage(ctx context.Context) bool
- func (p *ContainerListBlobFlatSegmentPager) PageResponse() ContainerListBlobFlatSegmentResponse
- type ContainerListBlobFlatSegmentResponse
- type ContainerListBlobFlatSegmentResult
- type ContainerListBlobHierarchySegmentOptions
- type ContainerListBlobHierarchySegmentPager
- func (p *ContainerListBlobHierarchySegmentPager) Err() error
- func (p *ContainerListBlobHierarchySegmentPager) NextPage(ctx context.Context) bool
- func (p *ContainerListBlobHierarchySegmentPager) PageResponse() ContainerListBlobHierarchySegmentResponse
- type ContainerListBlobHierarchySegmentResponse
- type ContainerListBlobHierarchySegmentResult
- type ContainerProperties
- func (c ContainerProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (c *ContainerProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type ContainerReleaseLeaseOptions
- type ContainerReleaseLeaseResponse
- type ContainerReleaseLeaseResult
- type ContainerRenewLeaseOptions
- type ContainerRenewLeaseResponse
- type ContainerRenewLeaseResult
- type ContainerRestoreOptions
- type ContainerRestoreResponse
- type ContainerRestoreResult
- type ContainerSASPermissions
- func (p *ContainerSASPermissions) Parse(s string) error
- func (p ContainerSASPermissions) String() string
- type ContainerSetAccessPolicyOptions
- type ContainerSetAccessPolicyResponse
- type ContainerSetAccessPolicyResult
- type ContainerSetMetadataOptions
- type ContainerSetMetadataResponse
- type ContainerSetMetadataResult
- type CopyBlockBlobFromURLOptions
- type CopyIncrementalPageBlobOptions
- type CopyStatusType
- func PossibleCopyStatusTypeValues() []CopyStatusType
- func (c CopyStatusType) ToPtr() *CopyStatusType
- type CorsRule
- type CpkInfo
- type CpkScopeInfo
- type CreateAppendBlobOptions
- type CreateBlobSnapshotOptions
- type CreateContainerOptions
- type CreatePageBlobOptions
- type DataLakeStorageError
- type DataLakeStorageErrorAutoGenerated
- type DeleteBlobOptions
- type DeleteContainerOptions
- type DeleteSnapshotsOptionType
- func PossibleDeleteSnapshotsOptionTypeValues() []DeleteSnapshotsOptionType
- func (c DeleteSnapshotsOptionType) ToPtr() *DeleteSnapshotsOptionType
- type DelimitedTextConfiguration
- type DirectoryCreateOptions
- type DirectoryCreateResponse
- type DirectoryCreateResult
- type DirectoryDeleteOptions
- type DirectoryDeleteResponse
- type DirectoryDeleteResult
- type DirectoryGetAccessControlOptions
- type DirectoryGetAccessControlResponse
- type DirectoryGetAccessControlResult
- type DirectoryHTTPHeaders
- type DirectoryRenameOptions
- type DirectoryRenameResponse
- type DirectoryRenameResult
- type DirectorySetAccessControlOptions
- type DirectorySetAccessControlResponse
- type DirectorySetAccessControlResult
- type DownloadBlobOptions
- type DownloadResponse
- type FailedReadNotifier
- type FilterBlobItem
- type FilterBlobSegment
- type GeoReplication
- func (g GeoReplication) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (g *GeoReplication) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type GeoReplicationStatusType
- func PossibleGeoReplicationStatusTypeValues() []GeoReplicationStatusType
- func (c GeoReplicationStatusType) ToPtr() *GeoReplicationStatusType
- type GetAccessPolicyOptions
- type GetBlobPropertiesOptions
- type GetBlobPropertiesResponse
- type GetBlockListOptions
- type GetPageRangesOptions
- type GetPropertiesOptionsContainer
- type GetTagsBlobOptions
- type HTTPGetter
- type HTTPGetterInfo
- type HighLevelDownloadFromBlobOptions
- type HighLevelUploadToBlockBlobOption
- type HttpRange
- type IPEndpointStyleInfo
- type IPRange
- type InternalError
- func (e *InternalError) As(target interface{}) bool
- func (e *InternalError) Error() string
- func (e *InternalError) Is(err error) bool
- type JSONTextConfiguration
- type KeyInfo
- type LeaseAccessConditions
- type LeaseDurationType
- func PossibleLeaseDurationTypeValues() []LeaseDurationType
- func (c LeaseDurationType) ToPtr() *LeaseDurationType
- type LeaseStateType
- func PossibleLeaseStateTypeValues() []LeaseStateType
- func (c LeaseStateType) ToPtr() *LeaseStateType
- type LeaseStatusType
- func PossibleLeaseStatusTypeValues() []LeaseStatusType
- func (c LeaseStatusType) ToPtr() *LeaseStatusType
- type ListBlobsFlatSegmentResponse
- type ListBlobsHierarchySegmentResponse
- type ListBlobsIncludeItem
- func PossibleListBlobsIncludeItemValues() []ListBlobsIncludeItem
- func (c ListBlobsIncludeItem) ToPtr() *ListBlobsIncludeItem
- type ListContainersDetail
- type ListContainersIncludeType
- func PossibleListContainersIncludeTypeValues() []ListContainersIncludeType
- func (c ListContainersIncludeType) ToPtr() *ListContainersIncludeType
- type ListContainersOptions
- type ListContainersSegmentResponse
- type Logging
- type Metrics
- type ModifiedAccessConditions
- type ObjectReplicationPolicy
- type ObjectReplicationRules
- type PageBlobClearPagesOptions
- type PageBlobClearPagesResponse
- type PageBlobClearPagesResult
- type PageBlobClient
- func NewPageBlobClient(blobURL string, cred azcore.Credential, options *ClientOptions) (PageBlobClient, error)
- func (pb PageBlobClient) ClearPages(ctx context.Context, pageRange HttpRange, options *ClearPagesOptions) (PageBlobClearPagesResponse, error)
- func (pb PageBlobClient) Create(ctx context.Context, size int64, options *CreatePageBlobOptions) (PageBlobCreateResponse, error)
- func (pb PageBlobClient) GetPageRanges(ctx context.Context, pageRange HttpRange, options *GetPageRangesOptions) (PageBlobGetPageRangesResponse, error)
- func (pb PageBlobClient) GetPageRangesDiff(ctx context.Context, pageRange HttpRange, prevSnapshot string, options *GetPageRangesOptions) (PageBlobGetPageRangesDiffResponse, error)
- func (pb PageBlobClient) Resize(ctx context.Context, size int64, options *ResizePageBlobOptions) (PageBlobResizeResponse, error)
- func (pb PageBlobClient) StartCopyIncremental(ctx context.Context, source string, prevSnapshot string, options *CopyIncrementalPageBlobOptions) (PageBlobCopyIncrementalResponse, error)
- func (pb PageBlobClient) UpdateSequenceNumber(ctx context.Context, options *UpdateSequenceNumberPageBlob) (PageBlobUpdateSequenceNumberResponse, error)
- func (pb PageBlobClient) UploadPages(ctx context.Context, body io.ReadSeekCloser, options *UploadPagesOptions) (PageBlobUploadPagesResponse, error)
- func (pb PageBlobClient) UploadPagesFromURL(ctx context.Context, source string, sourceOffset, destOffset, count int64, options *UploadPagesFromURLOptions) (PageBlobUploadPagesFromURLResponse, error)
- func (pb PageBlobClient) WithSnapshot(snapshot string) PageBlobClient
- func (pb PageBlobClient) WithVersionID(versionID string) PageBlobClient
- type PageBlobCopyIncrementalOptions
- type PageBlobCopyIncrementalResponse
- type PageBlobCopyIncrementalResult
- type PageBlobCreateOptions
- type PageBlobCreateResponse
- type PageBlobCreateResult
- type PageBlobGetPageRangesDiffOptions
- type PageBlobGetPageRangesDiffResponse
- type PageBlobGetPageRangesDiffResult
- type PageBlobGetPageRangesOptions
- type PageBlobGetPageRangesResponse
- type PageBlobGetPageRangesResult
- type PageBlobResizeOptions
- type PageBlobResizeResponse
- type PageBlobResizeResult
- type PageBlobUpdateSequenceNumberOptions
- type PageBlobUpdateSequenceNumberResponse
- type PageBlobUpdateSequenceNumberResult
- type PageBlobUploadPagesFromURLOptions
- type PageBlobUploadPagesFromURLResponse
- type PageBlobUploadPagesFromURLResult
- type PageBlobUploadPagesOptions
- type PageBlobUploadPagesResponse
- type PageBlobUploadPagesResult
- type PageList
- type PageRange
- type PathRenameMode
- func PossiblePathRenameModeValues() []PathRenameMode
- func (c PathRenameMode) ToPtr() *PathRenameMode
- type PremiumPageBlobAccessTier
- func PossiblePremiumPageBlobAccessTierValues() []PremiumPageBlobAccessTier
- func (c PremiumPageBlobAccessTier) ToPtr() *PremiumPageBlobAccessTier
- type PublicAccessType
- func PossiblePublicAccessTypeValues() []PublicAccessType
- func (c PublicAccessType) ToPtr() *PublicAccessType
- type QueryFormat
- type QueryFormatType
- func PossibleQueryFormatTypeValues() []QueryFormatType
- func (c QueryFormatType) ToPtr() *QueryFormatType
- type QueryRequest
- type QuerySerialization
- type RehydratePriority
- func PossibleRehydratePriorityValues() []RehydratePriority
- func (c RehydratePriority) ToPtr() *RehydratePriority
- type ReleaseLeaseBlobOptions
- type ReleaseLeaseContainerOptions
- type RenewLeaseBlobOptions
- type RenewLeaseContainerOptions
- type ResizePageBlobOptions
- type ResponseError
- type RetentionPolicy
- type RetryReaderOptions
- type SASProtocol
- type SASQueryParameters
- func (p *SASQueryParameters) CacheControl() string
- func (p *SASQueryParameters) ContentDisposition() string
- func (p *SASQueryParameters) ContentEncoding() string
- func (p *SASQueryParameters) ContentLanguage() string
- func (p *SASQueryParameters) ContentType() string
- func (p *SASQueryParameters) Encode() string
- func (p *SASQueryParameters) ExpiryTime() time.Time
- func (p *SASQueryParameters) IPRange() IPRange
- func (p *SASQueryParameters) Identifier() string
- func (p *SASQueryParameters) Permissions() string
- func (p *SASQueryParameters) Protocol() SASProtocol
- func (p *SASQueryParameters) Resource() string
- func (p *SASQueryParameters) ResourceTypes() string
- func (p *SASQueryParameters) Services() string
- func (p *SASQueryParameters) Signature() string
- func (p *SASQueryParameters) SignedExpiry() time.Time
- func (p *SASQueryParameters) SignedOid() string
- func (p *SASQueryParameters) SignedService() string
- func (p *SASQueryParameters) SignedStart() time.Time
- func (p *SASQueryParameters) SignedTid() string
- func (p *SASQueryParameters) SignedVersion() string
- func (p *SASQueryParameters) SnapshotTime() time.Time
- func (p *SASQueryParameters) StartTime() time.Time
- func (p *SASQueryParameters) Version() string
- type SKUName
- type SealAppendBlobOptions
- type SequenceNumberAccessConditions
- type SequenceNumberActionType
- func PossibleSequenceNumberActionTypeValues() []SequenceNumberActionType
- func (c SequenceNumberActionType) ToPtr() *SequenceNumberActionType
- type ServiceClient
- func NewServiceClient(serviceURL string, cred azcore.Credential, options *ClientOptions) (ServiceClient, error)
- func NewServiceClientFromConnectionString(connectionString string, options *ClientOptions) (ServiceClient, error)
- func (s ServiceClient) CanGetAccountSASToken() bool
- func (s ServiceClient) CreateContainer(ctx context.Context, containerName string, options *CreateContainerOptions) (ContainerCreateResponse, error)
- func (s ServiceClient) DeleteContainer(ctx context.Context, containerName string, options *DeleteContainerOptions) (ContainerDeleteResponse, error)
- func (s ServiceClient) FindBlobsByTags(ctx context.Context, options ServiceFilterBlobsByTagsOptions) (ServiceFilterBlobsResponse, error)
- func (s ServiceClient) GetAccountInfo(ctx context.Context) (ServiceGetAccountInfoResponse, error)
- func (s ServiceClient) GetProperties(ctx context.Context) (ServiceGetPropertiesResponse, error)
- func (s ServiceClient) GetSASToken(resources AccountSASResourceTypes, permissions AccountSASPermissions, services AccountSASServices, start time.Time, expiry time.Time) (string, error)
- func (s ServiceClient) GetStatistics(ctx context.Context) (ServiceGetStatisticsResponse, error)
- func (s ServiceClient) ListContainers(o *ListContainersOptions) *ServiceListContainersSegmentPager
- func (s ServiceClient) NewContainerClient(containerName string) ContainerClient
- func (s ServiceClient) SetProperties(ctx context.Context, properties StorageServiceProperties) (ServiceSetPropertiesResponse, error)
- func (s ServiceClient) URL() string
- type ServiceFilterBlobsByTagsOptions
- type ServiceFilterBlobsOptions
- type ServiceFilterBlobsResponse
- type ServiceFilterBlobsResult
- type ServiceGetAccountInfoOptions
- type ServiceGetAccountInfoResponse
- type ServiceGetAccountInfoResult
- type ServiceGetPropertiesOptions
- type ServiceGetPropertiesResponse
- type ServiceGetPropertiesResult
- type ServiceGetStatisticsOptions
- type ServiceGetStatisticsResponse
- type ServiceGetStatisticsResult
- type ServiceGetUserDelegationKeyOptions
- type ServiceGetUserDelegationKeyResponse
- type ServiceGetUserDelegationKeyResult
- type ServiceListContainersSegmentOptions
- type ServiceListContainersSegmentPager
- func (p *ServiceListContainersSegmentPager) Err() error
- func (p *ServiceListContainersSegmentPager) NextPage(ctx context.Context) bool
- func (p *ServiceListContainersSegmentPager) PageResponse() ServiceListContainersSegmentResponse
- type ServiceListContainersSegmentResponse
- type ServiceListContainersSegmentResult
- type ServiceSetPropertiesOptions
- type ServiceSetPropertiesResponse
- type ServiceSetPropertiesResult
- type ServiceSubmitBatchOptions
- type ServiceSubmitBatchResponse
- type ServiceSubmitBatchResult
- type SetAccessPolicyOptions
- type SetBlobHTTPHeadersOptions
- type SetBlobMetadataOptions
- type SetMetadataContainerOptions
- type SetTagsBlobOptions
- type SetTierOptions
- type SharedKeyCredential
- func NewSharedKeyCredential(accountName string, accountKey string) (*SharedKeyCredential, error)
- func (c *SharedKeyCredential) AccountName() string
- func (c *SharedKeyCredential) ComputeHMACSHA256(message string) (string, error)
- func (c *SharedKeyCredential) NewAuthenticationPolicy(options runtime.AuthenticationOptions) policy.Policy
- func (c *SharedKeyCredential) SetAccountKey(accountKey string) error
- type SignedIdentifier
- type SourceModifiedAccessConditions
- type StageBlockFromURLOptions
- type StageBlockOptions
- type StartCopyBlobOptions
- type StaticWebsite
- type StorageError
- func (e StorageError) Error() string
- func (e StorageError) Is(err error) bool
- func (e StorageError) Response() *http.Response
- func (e *StorageError) StatusCode() int
- func (e *StorageError) Temporary() bool
- func (e *StorageError) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
- type StorageErrorCode
- func PossibleStorageErrorCodeValues() []StorageErrorCode
- func (c StorageErrorCode) ToPtr() *StorageErrorCode
- type StorageServiceProperties
- type StorageServiceStats
- type TransferManager
- func NewStaticBuffer(size, max int) (TransferManager, error)
- func NewSyncPool(size, concurrency int) (TransferManager, error)
- type UpdateSequenceNumberPageBlob
- type UploadBlockBlobOptions
- type UploadPagesFromURLOptions
- type UploadPagesOptions
- type UploadStreamToBlockBlobOptions
- type UserDelegationKey
Examples ¶
- package
- package (BlobSnapshots)
- package (ProgressUploadDownload)
- AccountSASSignatureValues.Sign
- AppendBlobClient
- BlobAccessConditions
- BlobClient (StartCopy)
- BlobClient.Download
- BlobClient.SetMetadata
- BlobHTTPHeaders
- BlobSASSignatureValues
- BlobURLParts
- BlockBlobClient
- ContainerClient.SetAccessPolicy
- ContainerClient.SetMetadata
- ContainerLeaseClient
- PageBlobClient
- ServiceClient.GetSASToken
- StorageError
Constants ¶
const ( // BlockBlobMaxUploadBlobBytes indicates the maximum number of bytes that can be sent in a call to Upload. BlockBlobMaxUploadBlobBytes = 256 * 1024 * 1024 // 256MB // BlockBlobMaxStageBlockBytes indicates the maximum number of bytes that can be sent in a call to StageBlock. BlockBlobMaxStageBlockBytes = 4000 * 1024 * 1024 // 4GB // BlockBlobMaxBlocks indicates the maximum number of blocks allowed in a block blob. BlockBlobMaxBlocks = 50000 )
const ( // ContainerNameRoot is the special Azure Storage name used to identify a storage account's root container. ContainerNameRoot = "$root" // ContainerNameLogs is the special Azure Storage name used to identify a storage account's logs container. ContainerNameLogs = "$logs" )
nolint
const ( // ETagNone represents an empty entity tag. ETagNone = "" // ETagAny matches any entity tag. ETagAny = "*" )
const BlobDefaultDownloadBlockSize = int64(4 * 1024 * 1024) // 4MB
const CountToEnd = 0
const LeaseBreakNaturally = -1
LeaseBreakNaturally tells ContainerClient's or BlobClient's BreakLease method to break the lease using service semantics.
const ( // PageBlobPageBytes indicates the number of bytes in a page (512). PageBlobPageBytes = 512 )
const ReadOnClosedBodyMessage = "read on closed response body"
const SASTimeFormat = "2006-01-02T15:04:05Z" //"2017-07-27T00:00:00Z" // ISO 8601
SASTimeFormat represents the format of a SAS start or expiry time. Use it when formatting/parsing a time.Time.
const (
SASVersion = "2019-12-12"
)
nolint
const (
SnapshotTimeFormat = "2006-01-02T15:04:05.0000000Z07:00"
)
Variables ¶
var SASTimeFormats = []string{"2006-01-02T15:04:05.0000000Z", SASTimeFormat, "2006-01-02T15:04Z", "2006-01-02"} // ISO 8601 formats, please refer to https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas for more details.
Functions ¶
func DoBatchTransfer ¶
func DoBatchTransfer(ctx context.Context, o BatchTransferOptions) error
DoBatchTransfer helps to execute operations in a batch manner. Can be used by users to customize batch works (for other scenarios that the SDK does not provide)
func FormatTimesForSASSigning ¶
func FormatTimesForSASSigning(startTime, expiryTime, snapshotTime time.Time) (string, string, string)
FormatTimesForSASSigning converts a time.Time to a snapshotTimeFormat string suitable for a SASField's StartTime or ExpiryTime fields. Returns "" if value.IsZero().
func NewRetryReader ¶
func NewRetryReader(ctx context.Context, initialResponse *http.Response, info HTTPGetterInfo, o RetryReaderOptions, getter HTTPGetter) io.ReadCloser
NewRetryReader creates a retry reader.
Types ¶
type AbortCopyBlobOptions ¶
type AbortCopyBlobOptions struct { LeaseAccessConditions *LeaseAccessConditions }
type AccessPolicy ¶
type AccessPolicy struct { // the date-time the policy expires Expiry *time.Time `xml:"Expiry"` // the permissions for the acl policy Permission *string `xml:"Permission"` // the date-time the policy is active Start *time.Time `xml:"Start"` }
AccessPolicy - An Access policy
func (AccessPolicy) MarshalXML ¶
func (a AccessPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaller interface for type AccessPolicy.
func (*AccessPolicy) UnmarshalXML ¶
func (a *AccessPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaller interface for type AccessPolicy.
type AccessPolicyPermission ¶
type AccessPolicyPermission struct { Read, Add, Create, Write, Delete, List bool }
The AccessPolicyPermission type simplifies creating the permissions string for a container's access policy. Initialize an instance of this type and then call its String method to set AccessPolicy's Permission field.
func (*AccessPolicyPermission) Parse ¶
func (p *AccessPolicyPermission) Parse(s string) error
Parse initializes the AccessPolicyPermission's fields from a string.
func (AccessPolicyPermission) String ¶
func (p AccessPolicyPermission) String() string
String produces the access policy permission string for an Azure Storage container. Call this method to set AccessPolicy's Permission field.
type AccessTier ¶
type AccessTier string
const ( AccessTierArchive AccessTier = "Archive" AccessTierCool AccessTier = "Cool" AccessTierHot AccessTier = "Hot" AccessTierP10 AccessTier = "P10" AccessTierP15 AccessTier = "P15" AccessTierP20 AccessTier = "P20" AccessTierP30 AccessTier = "P30" AccessTierP4 AccessTier = "P4" AccessTierP40 AccessTier = "P40" AccessTierP50 AccessTier = "P50" AccessTierP6 AccessTier = "P6" AccessTierP60 AccessTier = "P60" AccessTierP70 AccessTier = "P70" AccessTierP80 AccessTier = "P80" )
func PossibleAccessTierValues ¶
func PossibleAccessTierValues() []AccessTier
PossibleAccessTierValues returns the possible values for the AccessTier const type.
func (AccessTier) ToPtr ¶
func (c AccessTier) ToPtr() *AccessTier
ToPtr returns a *AccessTier pointing to the current value.
type AccountKind ¶
type AccountKind string
const ( AccountKindStorage AccountKind = "Storage" AccountKindBlobStorage AccountKind = "BlobStorage" AccountKindStorageV2 AccountKind = "StorageV2" AccountKindFileStorage AccountKind = "FileStorage" AccountKindBlockBlobStorage AccountKind = "BlockBlobStorage" )
func PossibleAccountKindValues ¶
func PossibleAccountKindValues() []AccountKind
PossibleAccountKindValues returns the possible values for the AccountKind const type.
func (AccountKind) ToPtr ¶
func (c AccountKind) ToPtr() *AccountKind
ToPtr returns a *AccountKind pointing to the current value.
type AccountSASPermissions ¶
type AccountSASPermissions struct { Read, Write, Delete, DeletePreviousVersion, List, Add, Create, Update, Process bool }
The AccountSASPermissions type simplifies creating the permissions string for an Azure Storage Account SAS. Initialize an instance of this type and then call its String method to set AccountSASSignatureValues's Permissions field.
func (*AccountSASPermissions) Parse ¶
func (p *AccountSASPermissions) Parse(s string) error
Parse initializes the AccountSASPermissions's fields from a string.
func (AccountSASPermissions) String ¶
func (p AccountSASPermissions) String() string
String produces the SAS permissions string for an Azure Storage account. Call this method to set AccountSASSignatureValues's Permissions field.
type AccountSASResourceTypes ¶
type AccountSASResourceTypes struct { Service, Container, Object bool }
The AccountSASResourceTypes type simplifies creating the resource types string for an Azure Storage Account SAS. Initialize an instance of this type and then call its String method to set AccountSASSignatureValues's ResourceTypes field.
func (*AccountSASResourceTypes) Parse ¶
func (rt *AccountSASResourceTypes) Parse(s string) error
Parse initializes the AccountSASResourceType's fields from a string.
func (AccountSASResourceTypes) String ¶
func (rt AccountSASResourceTypes) String() string
String produces the SAS resource types string for an Azure Storage account. Call this method to set AccountSASSignatureValues's ResourceTypes field.
type AccountSASServices ¶
type AccountSASServices struct { Blob, Queue, File bool }
The AccountSASServices type simplifies creating the services string for an Azure Storage Account SAS. Initialize an instance of this type and then call its String method to set AccountSASSignatureValues's Services field.
func (*AccountSASServices) Parse ¶
func (s *AccountSASServices) Parse(str string) error
Parse initializes the AccountSASServices' fields from a string.
func (AccountSASServices) String ¶
func (s AccountSASServices) String() string
String produces the SAS services string for an Azure Storage account. Call this method to set AccountSASSignatureValues's Services field.
type AccountSASSignatureValues ¶
type AccountSASSignatureValues struct { Version string `param:"sv"` // If not specified, this defaults to SASVersion Protocol SASProtocol `param:"spr"` // See the SASProtocol* constants StartTime time.Time `param:"st"` // Not specified if IsZero ExpiryTime time.Time `param:"se"` // Not specified if IsZero Permissions string `param:"sp"` // Create by initializing a AccountSASPermissions and then call String() IPRange IPRange `param:"sip"` Services string `param:"ss"` // Create by initializing AccountSASServices and then call String() ResourceTypes string `param:"srt"` // Create by initializing AccountSASResourceTypes and then call String() }
AccountSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. For more information, see https://docs.microsoft.com/rest/api/storageservices/constructing-an-account-sas
func (AccountSASSignatureValues) Sign ¶
func (v AccountSASSignatureValues) Sign(sharedKeyCredential *SharedKeyCredential) (SASQueryParameters, error)
Sign uses an account's shared key credential to sign this signature values to produce
the proper SAS query parameters.
This example shows how to create and use an Azure Storage account Shared Access Signature (SAS).
Code:
Example¶
{
accountName, accountKey := accountInfo()
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
log.Fatal(err)
}
sasQueryParams, err := AccountSASSignatureValues{
Protocol: SASProtocolHTTPS,
ExpiryTime: time.Now().UTC().Add(48 * time.Hour),
Permissions: AccountSASPermissions{Read: true, List: true}.String(),
Services: AccountSASServices{Blob: true}.String(),
ResourceTypes: AccountSASResourceTypes{Container: true, Object: true}.String(),
}.Sign(credential)
if err != nil {
log.Fatal(err)
}
qp := sasQueryParams.Encode()
urlToSend := fmt.Sprintf("https://%s.blob.core.windows.net/?%s", accountName, qp)
// You can hand off this URL to someone else via any mechanism you choose.
// ******************************************
// When someone receives the URL, they can access the resource using it in code like this, or a tool of some variety.
serviceClient, err := NewServiceClient(urlToSend, azcore.NewAnonymousCredential(), nil)
if err != nil {
log.Fatal(err)
}
// You can also break a blob URL up into it's constituent parts
blobURLParts := NewBlobURLParts(serviceClient.URL())
fmt.Printf("SAS expiry time = %s\n", blobURLParts.SAS.ExpiryTime())
}
type AcquireLeaseBlobOptions ¶
type AcquireLeaseBlobOptions struct { // 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. A lease Duration cannot be changed using renew or change. Duration *int32 ModifiedAccessConditions *ModifiedAccessConditions }
type AcquireLeaseContainerOptions ¶
type AcquireLeaseContainerOptions struct { Duration *int32 ModifiedAccessConditions *ModifiedAccessConditions }
type AppendBlobAppendBlockFromURLOptions ¶
type AppendBlobAppendBlockFromURLOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // Specify the md5 calculated for the range of bytes that must be read from the copy source. SourceContentMD5 []byte // Specify the crc64 calculated for the range of bytes that must be read from the copy source. SourceContentcrc64 []byte // Bytes of source data in the specified range. SourceRange *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // Specify the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 []byte }
AppendBlobAppendBlockFromURLOptions contains the optional parameters for the AppendBlob.AppendBlockFromURL method.
type AppendBlobAppendBlockFromURLResponse ¶
type AppendBlobAppendBlockFromURLResponse struct { AppendBlobAppendBlockFromURLResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
AppendBlobAppendBlockFromURLResponse contains the response from method AppendBlob.AppendBlockFromURL.
type AppendBlobAppendBlockFromURLResult ¶
type AppendBlobAppendBlockFromURLResult struct { // BlobAppendOffset contains the information returned from the x-ms-blob-append-offset header response. BlobAppendOffset *string // BlobCommittedBlockCount contains the information returned from the x-ms-blob-committed-block-count header response. BlobCommittedBlockCount *int32 // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. IsServerEncrypted *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // XMSContentCRC64 contains the information returned from the x-ms-content-crc64 header response. XMSContentCRC64 []byte }
AppendBlobAppendBlockFromURLResult contains the result from method AppendBlob.AppendBlockFromURL.
type AppendBlobAppendBlockOptions ¶
type AppendBlobAppendBlockOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // Specify the transactional crc64 for the body, to be validated by the service. TransactionalContentCRC64 []byte // Specify the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 []byte }
AppendBlobAppendBlockOptions contains the optional parameters for the AppendBlob.AppendBlock method.
type AppendBlobAppendBlockResponse ¶
type AppendBlobAppendBlockResponse struct { AppendBlobAppendBlockResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
AppendBlobAppendBlockResponse contains the response from method AppendBlob.AppendBlock.
type AppendBlobAppendBlockResult ¶
type AppendBlobAppendBlockResult struct { // BlobAppendOffset contains the information returned from the x-ms-blob-append-offset header response. BlobAppendOffset *string // BlobCommittedBlockCount contains the information returned from the x-ms-blob-committed-block-count header response. BlobCommittedBlockCount *int32 // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. IsServerEncrypted *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // XMSContentCRC64 contains the information returned from the x-ms-content-crc64 header response. XMSContentCRC64 []byte }
AppendBlobAppendBlockResult contains the result from method AppendBlob.AppendBlock.
type AppendBlobClient ¶
type AppendBlobClient struct { BlobClient // contains filtered or unexported fields }
Example¶
ExampleAppendBlobClient shows how to append data (in blocks) to an append blob. An append blob can have a maximum of 50,000 blocks; each block can have a maximum of 100MB. Therefore, the maximum size of an append blob is slightly more than 4.75 TB (100 MB X 50,000 blocks).
Code:
{ // From the Azure portal, get your Storage account blob service URL endpoint. accountName, accountKey := accountInfo() // Create a ContainerClient object that wraps a soon-to-be-created blob's URL and a default pipeline. u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/MyAppendBlob.txt", accountName) credential, err := NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } appendBlobClient, err := NewAppendBlobClient(u, credential, nil) if err != nil { log.Fatal(err) } ctx := context.Background() // This example uses a never-expiring context _, err = appendBlobClient.Create(ctx, nil) if err != nil { log.Fatal(err) } for i := 0; i < 5; i++ { // Append 5 blocks to the append blob _, err := appendBlobClient.AppendBlock(ctx, NopCloser(strings.NewReader(fmt.Sprintf("Appending block #%d\n", i))), nil) if err != nil { log.Fatal(err) } } // Download the entire append blob's contents and show it. get, err := appendBlobClient.Download(ctx, nil) if err != nil { log.Fatal(err) } b := bytes.Buffer{} reader := get.Body(RetryReaderOptions{}) _, err = b.ReadFrom(reader) if err != nil { return } err = reader.Close() if err != nil { return } // The client must close the response body when finished with it fmt.Println(b.String()) }
func NewAppendBlobClient ¶
func NewAppendBlobClient(blobURL string, cred azcore.Credential, options *ClientOptions) (AppendBlobClient, error)
func (AppendBlobClient) AppendBlock ¶
func (ab AppendBlobClient) AppendBlock(ctx context.Context, body io.ReadSeekCloser, options *AppendBlockOptions) (AppendBlobAppendBlockResponse, error)
AppendBlock writes a stream to a new block of data to the end of the existing append blob. This method panics if the stream is not at position 0. Note that the http client closes the body stream after the request is sent to the service. For more information, see https://docs.microsoft.com/rest/api/storageservices/append-block.
func (AppendBlobClient) AppendBlockFromURL ¶
func (ab AppendBlobClient) AppendBlockFromURL(ctx context.Context, source string, options *AppendBlockURLOptions) (AppendBlobAppendBlockFromURLResponse, error)
AppendBlockFromURL copies a new block of data from source URL to the end of the existing append blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/append-block-from-url.
func (AppendBlobClient) Create ¶
func (ab AppendBlobClient) Create(ctx context.Context, options *CreateAppendBlobOptions) (AppendBlobCreateResponse, error)
Create creates a 0-size append blob. Call AppendBlock to append data to an append blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.
func (AppendBlobClient) SealAppendBlob ¶
func (ab AppendBlobClient) SealAppendBlob(ctx context.Context, options *SealAppendBlobOptions) (AppendBlobSealResponse, error)
SealAppendBlob - The purpose of Append Blob Seal is to allow users and applications to seal append blobs, marking them as read only. https://docs.microsoft.com/en-us/rest/api/storageservices/append-blob-seal
func (AppendBlobClient) WithSnapshot ¶
func (ab AppendBlobClient) WithSnapshot(snapshot string) AppendBlobClient
WithSnapshot creates a new AppendBlobURL object identical to the source but with the specified snapshot timestamp. Pass "" to remove the snapshot returning a URL to the base blob.
func (AppendBlobClient) WithVersionID ¶
func (ab AppendBlobClient) WithVersionID(versionID string) AppendBlobClient
WithVersionID creates a new AppendBlobURL object identical to the source but with the specified version id. Pass "" to remove the versionID returning a URL to the base blob.
type AppendBlobCreateOptions ¶
type AppendBlobCreateOptions struct { // Optional. Used to set blob tags in various blob operations. BlobTagsString *string // Optional. Specifies 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. Note that beginning with version 2009-09-19, metadata names must adhere to the naming // rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. Metadata map[string]string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
AppendBlobCreateOptions contains the optional parameters for the AppendBlob.Create method.
type AppendBlobCreateResponse ¶
type AppendBlobCreateResponse struct { AppendBlobCreateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
AppendBlobCreateResponse contains the response from method AppendBlob.Create.
type AppendBlobCreateResult ¶
type AppendBlobCreateResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. IsServerEncrypted *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // VersionID contains the information returned from the x-ms-version-id header response. VersionID *string }
AppendBlobCreateResult contains the result from method AppendBlob.Create.
type AppendBlobSealOptions ¶
type AppendBlobSealOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
AppendBlobSealOptions contains the optional parameters for the AppendBlob.Seal method.
type AppendBlobSealResponse ¶
type AppendBlobSealResponse struct { AppendBlobSealResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
AppendBlobSealResponse contains the response from method AppendBlob.Seal.
type AppendBlobSealResult ¶
type AppendBlobSealResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // IsSealed contains the information returned from the x-ms-blob-sealed header response. IsSealed *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
AppendBlobSealResult contains the result from method AppendBlob.Seal.
type AppendBlockOptions ¶
type AppendBlockOptions struct { // Specify the transactional crc64 for the body, to be validated by the service. TransactionalContentCRC64 []byte // Specify the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 []byte AppendPositionAccessConditions *AppendPositionAccessConditions CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo BlobAccessConditions *BlobAccessConditions }
type AppendBlockURLOptions ¶
type AppendBlockURLOptions struct { // Specify the md5 calculated for the range of bytes that must be read from the copy source. SourceContentMD5 []byte // Specify the crc64 calculated for the range of bytes that must be read from the copy source. SourceContentCRC64 []byte // Specify the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 []byte AppendPositionAccessConditions *AppendPositionAccessConditions CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo SourceModifiedAccessConditions *SourceModifiedAccessConditions BlobAccessConditions *BlobAccessConditions // Optional, you can specify whether a particular range of the blob is read Offset *int64 Count *int64 }
type AppendPositionAccessConditions ¶
type AppendPositionAccessConditions struct { // Optional conditional header, used only for the Append Block operation. 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 the AppendPositionConditionNotMet error (HTTP status code 412 // - Precondition Failed). AppendPosition *int64 // Optional conditional header. 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 MaxBlobSizeConditionNotMet error (HTTP // status code 412 - Precondition Failed). MaxSize *int64 }
AppendPositionAccessConditions contains a group of parameters for the AppendBlob.AppendBlock method.
type ArchiveStatus ¶
type ArchiveStatus string
const ( ArchiveStatusRehydratePendingToCool ArchiveStatus = "rehydrate-pending-to-cool" ArchiveStatusRehydratePendingToHot ArchiveStatus = "rehydrate-pending-to-hot" )
func PossibleArchiveStatusValues ¶
func PossibleArchiveStatusValues() []ArchiveStatus
PossibleArchiveStatusValues returns the possible values for the ArchiveStatus const type.
func (ArchiveStatus) ToPtr ¶
func (c ArchiveStatus) ToPtr() *ArchiveStatus
ToPtr returns a *ArchiveStatus pointing to the current value.
type BatchTransferOptions ¶
type BatchTransferOptions struct { TransferSize int64 ChunkSize int64 Parallelism uint16 Operation func(offset int64, chunkSize int64, ctx context.Context) error OperationName string }
BatchTransferOptions identifies options used by DoBatchTransfer.
type BlobAbortCopyFromURLOptions ¶
type BlobAbortCopyFromURLOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobAbortCopyFromURLOptions contains the optional parameters for the Blob.AbortCopyFromURL method.
type BlobAbortCopyFromURLResponse ¶
type BlobAbortCopyFromURLResponse struct { BlobAbortCopyFromURLResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobAbortCopyFromURLResponse contains the response from method Blob.AbortCopyFromURL.
type BlobAbortCopyFromURLResult ¶
type BlobAbortCopyFromURLResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobAbortCopyFromURLResult contains the result from method Blob.AbortCopyFromURL.
type BlobAccessConditions ¶
type BlobAccessConditions struct { LeaseAccessConditions *LeaseAccessConditions ModifiedAccessConditions *ModifiedAccessConditions }
BlobAccessConditions identifies blob-specific access conditions which you optionally set.
This example shows how to perform operations on blob conditionally.
Code:
Example¶
{
// From the Azure portal, get your Storage account's name and account key.
accountName, accountKey := accountInfo()
// Create a BlockBlobClient object that wraps a blob's URL and a default pipeline.
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
log.Fatal(err)
}
blockBlob, err := NewBlockBlobClient(fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/Data.txt", accountName), credential, nil)
if err != nil {
log.Fatal(err)
}
ctx := context.Background() // This example uses a never-expiring context
// This helper function displays the results of an operation; it is called frequently below.
showResult := func(response *DownloadResponse, err error) {
if err != nil {
if stgErr, ok := err.(*StorageError); !ok {
log.Fatal(err) // Network failure
} else {
// TODO: Port storage error
fmt.Print("Failure: " + stgErr.Error() + "\n")
}
} else {
err := response.Body(RetryReaderOptions{}).Close()
if err != nil {
return
} // The client must close the response body when finished with it
fmt.Print("Success: " + response.RawResponse.Status + "\n")
}
}
showResultUpload := func(upload BlockBlobUploadResponse, err error) {
if err != nil {
if stgErr, ok := err.(*StorageError); !ok {
log.Fatal(err) // Network failure
} else {
// TODO: Port storage error
fmt.Print("Failure: " + stgErr.Error() + "\n")
}
} else {
fmt.Print("Success: " + upload.RawResponse.Status + "\n")
}
}
// Create the blob (unconditionally; succeeds)
upload, err := blockBlob.Upload(ctx, NopCloser(strings.NewReader("Text-1")), nil)
showResultUpload(upload, err)
// showResult(upload, err)
// Download blob content if the blob has been modified since we uploaded it (fails):
showResult(blockBlob.Download(ctx, &DownloadBlobOptions{BlobAccessConditions: &BlobAccessConditions{ModifiedAccessConditions: &ModifiedAccessConditions{IfModifiedSince: upload.LastModified}}}))
// Download blob content if the blob hasn't been modified in the last 24 hours (fails):
showResult(blockBlob.Download(ctx, &DownloadBlobOptions{BlobAccessConditions: &BlobAccessConditions{ModifiedAccessConditions: &ModifiedAccessConditions{IfUnmodifiedSince: to.TimePtr(time.Now().UTC().Add(time.Hour * -24))}}}))
// Upload new content if the blob hasn't changed since the version identified by ETag (succeeds):
upload, err = blockBlob.Upload(ctx, NopCloser(strings.NewReader("Text-2")),
&UploadBlockBlobOptions{
BlobAccessConditions: &BlobAccessConditions{
ModifiedAccessConditions: &ModifiedAccessConditions{IfMatch: upload.ETag},
},
})
showResultUpload(upload, err)
// Download content if it has changed since the version identified by ETag (fails):
showResult(blockBlob.Download(ctx,
&DownloadBlobOptions{
BlobAccessConditions: &BlobAccessConditions{
ModifiedAccessConditions: &ModifiedAccessConditions{IfNoneMatch: upload.ETag}},
}))
// Upload content if the blob doesn't already exist (fails):
showResultUpload(blockBlob.Upload(ctx, NopCloser(strings.NewReader("Text-3")),
&UploadBlockBlobOptions{
BlobAccessConditions: &BlobAccessConditions{
ModifiedAccessConditions: &ModifiedAccessConditions{IfNoneMatch: to.StringPtr(ETagAny)},
}}))
}
type BlobAcquireLeaseOptions ¶
type BlobAcquireLeaseOptions struct { // 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. // A lease duration cannot be changed using renew or change. Duration *int32 // Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See // Guid Constructor (String) for a list of valid GUID string formats. ProposedLeaseID *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobAcquireLeaseOptions contains the optional parameters for the Blob.AcquireLease method.
type BlobAcquireLeaseResponse ¶
type BlobAcquireLeaseResponse struct { BlobAcquireLeaseResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobAcquireLeaseResponse contains the response from method Blob.AcquireLease.
type BlobAcquireLeaseResult ¶
type BlobAcquireLeaseResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // LeaseID contains the information returned from the x-ms-lease-id header response. LeaseID *string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobAcquireLeaseResult contains the result from method Blob.AcquireLease.
type BlobBreakLeaseOptions ¶
type BlobBreakLeaseOptions 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 *int32 // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobBreakLeaseOptions contains the optional parameters for the Blob.BreakLease method.
type BlobBreakLeaseResponse ¶
type BlobBreakLeaseResponse struct { BlobBreakLeaseResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobBreakLeaseResponse contains the response from method Blob.BreakLease.
type BlobBreakLeaseResult ¶
type BlobBreakLeaseResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // LeaseTime contains the information returned from the x-ms-lease-time header response. LeaseTime *int32 // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobBreakLeaseResult contains the result from method Blob.BreakLease.
type BlobChangeLeaseOptions ¶
type BlobChangeLeaseOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobChangeLeaseOptions contains the optional parameters for the Blob.ChangeLease method.
type BlobChangeLeaseResponse ¶
type BlobChangeLeaseResponse struct { BlobChangeLeaseResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobChangeLeaseResponse contains the response from method Blob.ChangeLease.
type BlobChangeLeaseResult ¶
type BlobChangeLeaseResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // LeaseID contains the information returned from the x-ms-lease-id header response. LeaseID *string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobChangeLeaseResult contains the result from method Blob.ChangeLease.
type BlobClient ¶
type BlobClient struct {
// contains filtered or unexported fields
}
A BlobClient represents a URL to an Azure Storage blob; the blob may be a block blob, append blob, or page blob.
This example shows how to copy a source document on the Internet to a blob.
Code:
Example (StartCopy)¶
{
// From the Azure portal, get your Storage account blob service URL endpoint.
accountName, accountKey := accountInfo()
// Create a ContainerClient object to a container where we'll create a blob and its snapshot.
// Create a BlockBlobClient object to a blob in the container.
u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/CopiedBlob.bin", accountName)
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
log.Fatal(err)
}
blobClient, err := NewBlobClient(u, credential, nil)
if err != nil {
log.Fatal(err)
}
ctx := context.Background() // This example uses a never-expiring context
src := "https://cdn2.auth0.com/docs/media/addons/azure_blob.svg"
startCopy, err := blobClient.StartCopyFromURL(ctx, src, nil)
if err != nil {
log.Fatal(err)
}
copyID := *startCopy.CopyID
copyStatus := *startCopy.CopyStatus
for copyStatus == CopyStatusTypePending {
time.Sleep(time.Second * 2)
getMetadata, err := blobClient.GetProperties(ctx, nil)
if err != nil {
log.Fatal(err)
}
copyStatus = *getMetadata.CopyStatus
}
fmt.Printf("Copy from %s to %s: ID=%s, Status=%s\n", src, blobClient.URL(), copyID, copyStatus)
}
func NewBlobClient ¶
func NewBlobClient(blobURL string, cred azcore.Credential, options *ClientOptions) (BlobClient, error)
NewBlobClient creates a BlobClient object using the specified URL and request policy pipeline.
func NewBlobClientFromConnectionString ¶
func NewBlobClientFromConnectionString(connectionString, containerName, blobName string, options *ClientOptions) (BlobClient, error)
NewBlobClientFromConnectionString creates BlobClient from a Connection String nolint
func (BlobClient) AbortCopyFromURL ¶
func (b BlobClient) AbortCopyFromURL(ctx context.Context, copyID string, options *AbortCopyBlobOptions) (BlobAbortCopyFromURLResponse, error)
AbortCopyFromURL stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. For more information, see https://docs.microsoft.com/rest/api/storageservices/abort-copy-blob.
func (BlobClient) CreateSnapshot ¶
func (b BlobClient) CreateSnapshot(ctx context.Context, options *CreateBlobSnapshotOptions) (BlobCreateSnapshotResponse, error)
CreateSnapshot creates a read-only snapshot of a blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/snapshot-blob.
func (BlobClient) Delete ¶
func (b BlobClient) Delete(ctx context.Context, options *DeleteBlobOptions) (BlobDeleteResponse, error)
Delete marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection. Note that deleting a blob also deletes all its snapshots. For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-blob.
func (BlobClient) Download ¶
func (b BlobClient) Download(ctx context.Context, options *DownloadBlobOptions) (*DownloadResponse, error)
Download reads a range of bytes from a blob. The response also includes the blob's properties and metadata.
For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob.
This example shows how to download a large stream with intelligent retries. Specifically, if
the connection fails while reading, continuing to read from this stream initiates a new
GetBlob call passing a range that starts from the last byte successfully read before the failure.
Code:
Example¶
{
// From the Azure portal, get your Storage account blob service URL endpoint.
accountName, accountKey := accountInfo()
// Create a BlobClient object to a blob in the container (we assume the container & blob already exist).
u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/BigBlob.bin", accountName)
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
log.Fatal(err)
}
blobClient, err := NewBlobClient(u, credential, nil)
if err != nil {
log.Fatal(err)
}
contentLength := int64(0) // Used for progress reporting to report the total number of bytes being downloaded.
// Download returns an intelligent retryable stream around a blob; it returns an io.ReadCloser.
dr, err := blobClient.Download(context.TODO(), nil)
if err != nil {
log.Fatal(err)
}
rs := dr.Body(RetryReaderOptions{})
// NewResponseBodyProgress wraps the GetRetryStream with progress reporting; it returns an io.ReadCloser.
stream := streaming.NewResponseProgress(rs,
func(bytesTransferred int64) {
fmt.Printf("Downloaded %d of %d bytes.\n", bytesTransferred, contentLength)
})
defer func(stream io.ReadCloser) {
err := stream.Close()
if err != nil {
}
}(stream) // The client must close the response body when finished with it
file, err := os.Create("BigFile.bin") // Create the file to hold the downloaded blob contents.
if err != nil {
log.Fatal(err)
}
defer func(file *os.File) {
err := file.Close()
if err != nil {
}
}(file)
written, err := io.Copy(file, stream) // Write to the file by reading from the blob (with intelligent retries).
if err != nil {
log.Fatal(err)
}
_ = written // Avoid compiler's "declared and not used" error
}
func (BlobClient) DownloadBlobToBuffer ¶
func (b BlobClient) DownloadBlobToBuffer(ctx context.Context, offset int64, count int64, _bytes []byte, o HighLevelDownloadFromBlobOptions) error
DownloadBlobToBuffer downloads an Azure blob to a buffer with parallel. Offset and count are optional, pass 0 for both to download the entire blob.
func (BlobClient) DownloadBlobToFile ¶
func (b BlobClient) DownloadBlobToFile(ctx context.Context, offset int64, count int64, file *os.File, o HighLevelDownloadFromBlobOptions) error
DownloadBlobToFile downloads an Azure blob to a local file. The file would be truncated if the size doesn't match. Offset and count are optional, pass 0 for both to download the entire blob.
func (BlobClient) GetProperties ¶
func (b BlobClient) GetProperties(ctx context.Context, options *GetBlobPropertiesOptions) (GetBlobPropertiesResponse, error)
GetProperties returns the blob's properties. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob-properties.
func (BlobClient) GetSASToken ¶
func (b BlobClient) GetSASToken(permissions BlobSASPermissions, start time.Time, expiry time.Time) (SASQueryParameters, error)
GetSASToken is a convenience method for generating a SAS token for the currently pointed at blob. It can only be used if the supplied azcore.Credential during creation was a SharedKeyCredential.
func (BlobClient) GetTags ¶
func (b BlobClient) GetTags(ctx context.Context, options *GetTagsBlobOptions) (BlobGetTagsResponse, error)
GetTags operation enables users to get tags on a blob or specific blob version, or snapshot. https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-tags
func (BlobClient) NewBlobLeaseClient ¶
func (b BlobClient) NewBlobLeaseClient(leaseID *string) (BlobLeaseClient, error)
func (BlobClient) SetHTTPHeaders ¶
func (b BlobClient) SetHTTPHeaders(ctx context.Context, blobHttpHeaders BlobHTTPHeaders, options *SetBlobHTTPHeadersOptions) (BlobSetHTTPHeadersResponse, error)
SetHTTPHeaders changes a blob's HTTP headers. For more information, see https://docs.microsoft.com/rest/api/storageservices/set-blob-properties.
func (BlobClient) SetMetadata ¶
func (b BlobClient) SetMetadata(ctx context.Context, metadata map[string]string, options *SetBlobMetadataOptions) (BlobSetMetadataResponse, error)
SetMetadata changes a blob's metadata.
https://docs.microsoft.com/rest/api/storageservices/set-blob-metadata.
This examples shows how to create a blob with metadata and then how to read & update
the blob's read-only properties and metadata.
Code:
Example¶
{
// From the Azure portal, get your Storage account blob service URL endpoint.
accountName, accountKey := accountInfo()
// Create a blob client
u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/ReadMe.txt", accountName)
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
log.Fatal(err)
}
BlobClient, err := NewBlockBlobClient(u, credential, nil)
if err != nil {
log.Fatal(err)
}
ctx := context.Background() // This example uses a never-expiring context
// Create a blob with metadata (string key/value pairs)
// NOTE: Metadata key names are always converted to lowercase before being sent to the Storage Service.
// Therefore, you should always use lowercase letters; especially when querying a map for a metadata key.
creatingApp, _ := os.Executable()
_, err = BlobClient.Upload(ctx, NopCloser(NopCloser(strings.NewReader("Some text"))), &UploadBlockBlobOptions{Metadata: map[string]string{"author": "Jeffrey", "app": creatingApp}})
if err != nil {
log.Fatal(err)
}
// Query the blob's properties and metadata
get, err := BlobClient.GetProperties(ctx, nil)
if err != nil {
log.Fatal(err)
}
// Show some of the blob's read-only properties
fmt.Println(*get.BlobType, *get.ETag, *get.LastModified)
// Show the blob's metadata
if get.Metadata == nil {
log.Fatal("No metadata returned")
}
metadata := get.Metadata
for k, v := range metadata {
fmt.Print(k + "=" + v + "\n")
}
// Update the blob's metadata and write it back to the blob
metadata["editor"] = "Grant" // Add a new key/value; NOTE: The keyname is in all lowercase letters
_, err = BlobClient.SetMetadata(ctx, metadata, nil)
if err != nil {
log.Fatal(err)
}
// NOTE: The SetMetadata method updates the blob's ETag & LastModified properties
}
func (BlobClient) SetTags ¶
func (b BlobClient) SetTags(ctx context.Context, options *SetTagsBlobOptions) (BlobSetTagsResponse, error)
SetTags operation enables users to set tags on a blob or specific blob version, but not snapshot. Each call to this operation replaces all existing tags attached to the blob. To remove all tags from the blob, call this operation with no tags set. https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tags
func (BlobClient) SetTier ¶
func (b BlobClient) SetTier(ctx context.Context, tier AccessTier, options *SetTierOptions) (BlobSetTierResponse, error)
SetTier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. For detailed information about block blob level tiering see https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-storage-tiers.
func (BlobClient) StartCopyFromURL ¶
func (b BlobClient) StartCopyFromURL(ctx context.Context, copySource string, options *StartCopyBlobOptions) (BlobStartCopyFromURLResponse, error)
StartCopyFromURL copies the data at the source URL to a blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/copy-blob.
func (BlobClient) URL ¶
func (b BlobClient) URL() string
URL returns the URL endpoint used by the BlobClient object.
func (BlobClient) Undelete ¶
func (b BlobClient) Undelete(ctx context.Context) (BlobUndeleteResponse, error)
Undelete restores the contents and metadata of a soft-deleted blob and any associated soft-deleted snapshots. For more information, see https://docs.microsoft.com/rest/api/storageservices/undelete-blob.
func (BlobClient) WithSnapshot ¶
func (b BlobClient) WithSnapshot(snapshot string) BlobClient
WithSnapshot creates a new BlobClient object identical to the source but with the specified snapshot timestamp. Pass "" to remove the snapshot returning a URL to the base blob.
func (BlobClient) WithVersionID ¶
func (b BlobClient) WithVersionID(versionID string) BlockBlobClient
WithVersionID creates a new AppendBlobURL object identical to the source but with the specified version id. Pass "" to remove the versionID returning a URL to the base blob.
type BlobCopyFromURLOptions ¶
type BlobCopyFromURLOptions struct { // Optional. Used to set blob tags in various blob operations. BlobTagsString *string // Optional. Specifies 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. Note that beginning with version 2009-09-19, metadata names must adhere to the naming // rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. Metadata map[string]string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // Specify the md5 calculated for the range of bytes that must be read from the copy source. SourceContentMD5 []byte // Optional. Indicates the tier to be set on the blob. Tier *AccessTier // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobCopyFromURLOptions contains the optional parameters for the Blob.CopyFromURL method.
type BlobCopyFromURLResponse ¶
type BlobCopyFromURLResponse struct { BlobCopyFromURLResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobCopyFromURLResponse contains the response from method Blob.CopyFromURL.
type BlobCopyFromURLResult ¶
type BlobCopyFromURLResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // CopyID contains the information returned from the x-ms-copy-id header response. CopyID *string // CopyStatus contains the information returned from the x-ms-copy-status header response. CopyStatus *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // VersionID contains the information returned from the x-ms-version-id header response. VersionID *string // XMSContentCRC64 contains the information returned from the x-ms-content-crc64 header response. XMSContentCRC64 []byte }
BlobCopyFromURLResult contains the result from method Blob.CopyFromURL.
type BlobCreateSnapshotOptions ¶
type BlobCreateSnapshotOptions struct { // Optional. Specifies 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. Note that beginning with version 2009-09-19, metadata names must adhere to the naming // rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. Metadata map[string]string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobCreateSnapshotOptions contains the optional parameters for the Blob.CreateSnapshot method.
type BlobCreateSnapshotResponse ¶
type BlobCreateSnapshotResponse struct { BlobCreateSnapshotResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobCreateSnapshotResponse contains the response from method Blob.CreateSnapshot.
type BlobCreateSnapshotResult ¶
type BlobCreateSnapshotResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. IsServerEncrypted *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Snapshot contains the information returned from the x-ms-snapshot header response. Snapshot *string // Version contains the information returned from the x-ms-version header response. Version *string // VersionID contains the information returned from the x-ms-version-id header response. VersionID *string }
BlobCreateSnapshotResult contains the result from method Blob.CreateSnapshot.
type BlobDeleteOptions ¶
type BlobDeleteOptions struct { // Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob and all of its snapshots. only: // Delete only the blob's snapshots and not the blob itself DeleteSnapshots *DeleteSnapshotsOptionType // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with // blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot // of a Blob.</a> Snapshot *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 // and newer. VersionID *string }
BlobDeleteOptions contains the optional parameters for the Blob.Delete method.
type BlobDeleteResponse ¶
type BlobDeleteResponse struct { BlobDeleteResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobDeleteResponse contains the response from method Blob.Delete.
type BlobDeleteResult ¶
type BlobDeleteResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobDeleteResult contains the result from method Blob.Delete.
type BlobDownloadOptions ¶
type BlobDownloadOptions struct { // Return only the bytes of the blob in the specified range. Range *string // When set to true and specified together with the Range, the service returns the CRC64 hash for the range, as long as the range is less than or equal // to 4 MB in size. RangeGetContentCRC64 *bool // When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the range is less than or equal to // 4 MB in size. RangeGetContentMD5 *bool // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with // blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot // of a Blob.</a> Snapshot *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 // and newer. VersionID *string }
BlobDownloadOptions contains the optional parameters for the Blob.Download method.
type BlobDownloadResponse ¶
type BlobDownloadResponse struct { BlobDownloadResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobDownloadResponse contains the response from method Blob.Download.
func (BlobDownloadResponse) GetHTTPHeaders ¶
func (dr BlobDownloadResponse) GetHTTPHeaders() BlobHTTPHeaders
GetHTTPHeaders returns the user-modifiable properties for this blob.
type BlobDownloadResult ¶
type BlobDownloadResult struct { // AcceptRanges contains the information returned from the Accept-Ranges header response. AcceptRanges *string // BlobCommittedBlockCount contains the information returned from the x-ms-blob-committed-block-count header response. BlobCommittedBlockCount *int32 // BlobContentMD5 contains the information returned from the x-ms-blob-content-md5 header response. BlobContentMD5 []byte // BlobSequenceNumber contains the information returned from the x-ms-blob-sequence-number header response. BlobSequenceNumber *int64 // BlobType contains the information returned from the x-ms-blob-type header response. BlobType *BlobType // CacheControl contains the information returned from the Cache-Control header response. CacheControl *string // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentCRC64 contains the information returned from the x-ms-content-crc64 header response. ContentCRC64 []byte // ContentDisposition contains the information returned from the Content-Disposition header response. ContentDisposition *string // ContentEncoding contains the information returned from the Content-Encoding header response. ContentEncoding *string // ContentLanguage contains the information returned from the Content-Language header response. ContentLanguage *string // ContentLength contains the information returned from the Content-Length header response. ContentLength *int64 // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // ContentRange contains the information returned from the Content-Range header response. ContentRange *string // ContentType contains the information returned from the Content-Type header response. ContentType *string // CopyCompletionTime contains the information returned from the x-ms-copy-completion-time header response. CopyCompletionTime *time.Time // CopyID contains the information returned from the x-ms-copy-id header response. CopyID *string // CopyProgress contains the information returned from the x-ms-copy-progress header response. CopyProgress *string // CopySource contains the information returned from the x-ms-copy-source header response. CopySource *string // CopyStatus contains the information returned from the x-ms-copy-status header response. CopyStatus *CopyStatusType // CopyStatusDescription contains the information returned from the x-ms-copy-status-description header response. CopyStatusDescription *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // IsCurrentVersion contains the information returned from the x-ms-is-current-version header response. IsCurrentVersion *bool // IsSealed contains the information returned from the x-ms-blob-sealed header response. IsSealed *bool // IsServerEncrypted contains the information returned from the x-ms-server-encrypted header response. IsServerEncrypted *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // LeaseDuration contains the information returned from the x-ms-lease-duration header response. LeaseDuration *LeaseDurationType // LeaseState contains the information returned from the x-ms-lease-state header response. LeaseState *LeaseStateType // LeaseStatus contains the information returned from the x-ms-lease-status header response. LeaseStatus *LeaseStatusType // Metadata contains the information returned from the x-ms-meta header response. Metadata map[string]string // ObjectReplicationPolicyID contains the information returned from the x-ms-or-policy-id header response. ObjectReplicationPolicyID *string // ObjectReplicationRules contains the information returned from the x-ms-or header response. ObjectReplicationRules map[string]string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // TagCount contains the information returned from the x-ms-tag-count header response. TagCount *int64 // Version contains the information returned from the x-ms-version header response. Version *string // VersionID contains the information returned from the x-ms-version-id header response. VersionID *string }
BlobDownloadResult contains the result from method Blob.Download.
type BlobExpiryOptions ¶
type BlobExpiryOptions string
const ( BlobExpiryOptionsAbsolute BlobExpiryOptions = "Absolute" BlobExpiryOptionsNeverExpire BlobExpiryOptions = "NeverExpire" BlobExpiryOptionsRelativeToCreation BlobExpiryOptions = "RelativeToCreation" BlobExpiryOptionsRelativeToNow BlobExpiryOptions = "RelativeToNow" )
func PossibleBlobExpiryOptionsValues ¶
func PossibleBlobExpiryOptionsValues() []BlobExpiryOptions
PossibleBlobExpiryOptionsValues returns the possible values for the BlobExpiryOptions const type.
func (BlobExpiryOptions) ToPtr ¶
func (c BlobExpiryOptions) ToPtr() *BlobExpiryOptions
ToPtr returns a *BlobExpiryOptions pointing to the current value.
type BlobFlatListSegment ¶
type BlobFlatListSegment struct { // REQUIRED BlobItems []*BlobItemInternal `xml:"Blob"` }
func (BlobFlatListSegment) MarshalXML ¶
func (b BlobFlatListSegment) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaller interface for type BlobFlatListSegment.
type BlobGetAccessControlOptions ¶
type BlobGetAccessControlOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the identity values returned in the x-ms-owner, x-ms-group, and // x-ms-acl response headers will be transformed from Azure Active Directory Object IDs to User Principal Names. If "false", the values will be returned // as Azure Active Directory Object IDs. The default value is false. Upn *bool }
BlobGetAccessControlOptions contains the optional parameters for the Blob.GetAccessControl method.
type BlobGetAccessControlResponse ¶
type BlobGetAccessControlResponse struct { BlobGetAccessControlResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobGetAccessControlResponse contains the response from method Blob.GetAccessControl.
type BlobGetAccessControlResult ¶
type BlobGetAccessControlResult struct { // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // XMSACL contains the information returned from the x-ms-acl header response. XMSACL *string // XMSGroup contains the information returned from the x-ms-group header response. XMSGroup *string // XMSOwner contains the information returned from the x-ms-owner header response. XMSOwner *string // XMSPermissions contains the information returned from the x-ms-permissions header response. XMSPermissions *string }
BlobGetAccessControlResult contains the result from method Blob.GetAccessControl.
type BlobGetAccountInfoOptions ¶
type BlobGetAccountInfoOptions struct { }
BlobGetAccountInfoOptions contains the optional parameters for the Blob.GetAccountInfo method.
type BlobGetAccountInfoResponse ¶
type BlobGetAccountInfoResponse struct { BlobGetAccountInfoResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobGetAccountInfoResponse contains the response from method Blob.GetAccountInfo.
type BlobGetAccountInfoResult ¶
type BlobGetAccountInfoResult struct { // AccountKind contains the information returned from the x-ms-account-kind header response. AccountKind *AccountKind // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // SKUName contains the information returned from the x-ms-sku-name header response. SKUName *SKUName // Version contains the information returned from the x-ms-version header response. Version *string }
BlobGetAccountInfoResult contains the result from method Blob.GetAccountInfo.
type BlobGetPropertiesOptions ¶
type BlobGetPropertiesOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with // blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot // of a Blob.</a> Snapshot *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 // and newer. VersionID *string }
BlobGetPropertiesOptions contains the optional parameters for the Blob.GetProperties method.
type BlobGetPropertiesResponse ¶
type BlobGetPropertiesResponse struct { BlobGetPropertiesResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobGetPropertiesResponse contains the response from method Blob.GetProperties.
func (BlobGetPropertiesResponse) GetHTTPHeaders ¶
func (bgpr BlobGetPropertiesResponse) GetHTTPHeaders() BlobHTTPHeaders
GetHTTPHeaders returns the user-modifiable properties for this blob.
type BlobGetPropertiesResult ¶
type BlobGetPropertiesResult struct { // AcceptRanges contains the information returned from the Accept-Ranges header response. AcceptRanges *string // AccessTier contains the information returned from the x-ms-access-tier header response. AccessTier *string // AccessTierChangeTime contains the information returned from the x-ms-access-tier-change-time header response. AccessTierChangeTime *time.Time // AccessTierInferred contains the information returned from the x-ms-access-tier-inferred header response. AccessTierInferred *bool // ArchiveStatus contains the information returned from the x-ms-archive-status header response. ArchiveStatus *string // BlobCommittedBlockCount contains the information returned from the x-ms-blob-committed-block-count header response. BlobCommittedBlockCount *int32 // BlobSequenceNumber contains the information returned from the x-ms-blob-sequence-number header response. BlobSequenceNumber *int64 // BlobType contains the information returned from the x-ms-blob-type header response. BlobType *BlobType // CacheControl contains the information returned from the Cache-Control header response. CacheControl *string // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentDisposition contains the information returned from the Content-Disposition header response. ContentDisposition *string // ContentEncoding contains the information returned from the Content-Encoding header response. ContentEncoding *string // ContentLanguage contains the information returned from the Content-Language header response. ContentLanguage *string // ContentLength contains the information returned from the Content-Length header response. ContentLength *int64 // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // ContentType contains the information returned from the Content-Type header response. ContentType *string // CopyCompletionTime contains the information returned from the x-ms-copy-completion-time header response. CopyCompletionTime *time.Time // CopyID contains the information returned from the x-ms-copy-id header response. CopyID *string // CopyProgress contains the information returned from the x-ms-copy-progress header response. CopyProgress *string // CopySource contains the information returned from the x-ms-copy-source header response. CopySource *string // CopyStatus contains the information returned from the x-ms-copy-status header response. CopyStatus *CopyStatusType // CopyStatusDescription contains the information returned from the x-ms-copy-status-description header response. CopyStatusDescription *string // CreationTime contains the information returned from the x-ms-creation-time header response. CreationTime *time.Time // Date contains the information returned from the Date header response. Date *time.Time // DestinationSnapshot contains the information returned from the x-ms-copy-destination-snapshot header response. DestinationSnapshot *string // ETag contains the information returned from the ETag header response. ETag *string // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // ExpiresOn contains the information returned from the x-ms-expiry-time header response. ExpiresOn *time.Time // IsCurrentVersion contains the information returned from the x-ms-is-current-version header response. IsCurrentVersion *bool // IsIncrementalCopy contains the information returned from the x-ms-incremental-copy header response. IsIncrementalCopy *bool // IsSealed contains the information returned from the x-ms-blob-sealed header response. IsSealed *bool // IsServerEncrypted contains the information returned from the x-ms-server-encrypted header response. IsServerEncrypted *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // LeaseDuration contains the information returned from the x-ms-lease-duration header response. LeaseDuration *LeaseDurationType // LeaseState contains the information returned from the x-ms-lease-state header response. LeaseState *LeaseStateType // LeaseStatus contains the information returned from the x-ms-lease-status header response. LeaseStatus *LeaseStatusType // Metadata contains the information returned from the x-ms-meta header response. Metadata map[string]string // ObjectReplicationPolicyID contains the information returned from the x-ms-or-policy-id header response. ObjectReplicationPolicyID *string // ObjectReplicationRules contains the information returned from the x-ms-or header response. ObjectReplicationRules map[string]string // RehydratePriority contains the information returned from the x-ms-rehydrate-priority header response. RehydratePriority *string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // TagCount contains the information returned from the x-ms-tag-count header response. TagCount *int64 // Version contains the information returned from the x-ms-version header response. Version *string // VersionID contains the information returned from the x-ms-version-id header response. VersionID *string }
BlobGetPropertiesResult contains the result from method Blob.GetProperties.
type BlobGetTagsOptions ¶
type BlobGetTagsOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with // blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot // of a Blob.</a> Snapshot *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 // and newer. VersionID *string }
BlobGetTagsOptions contains the optional parameters for the Blob.GetTags method.
type BlobGetTagsResponse ¶
type BlobGetTagsResponse struct { BlobGetTagsResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobGetTagsResponse contains the response from method Blob.GetTags.
type BlobGetTagsResult ¶
type BlobGetTagsResult struct { BlobTags // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string `xml:"ClientRequestID"` // Date contains the information returned from the Date header response. Date *time.Time `xml:"Date"` // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string `xml:"RequestID"` // Version contains the information returned from the x-ms-version header response. Version *string `xml:"Version"` }
BlobGetTagsResult contains the result from method Blob.GetTags.
type BlobHTTPHeaders ¶
type BlobHTTPHeaders struct { // Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request. BlobCacheControl *string // Optional. Sets the blob's Content-Disposition header. BlobContentDisposition *string // Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request. BlobContentEncoding *string // Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read request. BlobContentLanguage *string // Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks were validated when each was // uploaded. BlobContentMD5 []byte // Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request. BlobContentType *string }
BlobHTTPHeaders contains a group of parameters for the Blob.SetHTTPHeaders method.
This examples shows how to create a blob with HTTP Headers and then how to read & update
the blob's HTTP headers.
Code:
Example¶
{
// From the Azure portal, get your Storage account blob service URL endpoint.
accountName, accountKey := accountInfo()
// Create a blob client
u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/ReadMe.txt", accountName)
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
log.Fatal(err)
}
blobClient, err := NewBlockBlobClient(u, credential, nil)
if err != nil {
log.Fatal(err)
}
ctx := context.Background() // This example uses a never-expiring context
// Create a blob with HTTP headers
_, err = blobClient.Upload(ctx, NopCloser(NopCloser(strings.NewReader("Some text"))),
&UploadBlockBlobOptions{HTTPHeaders: &BlobHTTPHeaders{
BlobContentType: to.StringPtr("text/html; charset=utf-8"),
BlobContentDisposition: to.StringPtr("attachment"),
}})
if err != nil {
log.Fatal(err)
}
// GetMetadata returns the blob's properties, HTTP headers, and metadata
get, err := blobClient.GetProperties(ctx, nil)
if err != nil {
log.Fatal(err)
}
// Show some of the blob's read-only properties
fmt.Println(*get.BlobType, *get.ETag, *get.LastModified)
// Shows some of the blob's HTTP Headers
httpHeaders := get.GetHTTPHeaders()
fmt.Println(httpHeaders.BlobContentType, httpHeaders.BlobContentDisposition)
// Update the blob's HTTP Headers and write them back to the blob
httpHeaders.BlobContentType = to.StringPtr("text/plain")
_, err = blobClient.SetHTTPHeaders(ctx, httpHeaders, nil)
if err != nil {
log.Fatal(err)
}
// NOTE: The SetMetadata method updates the blob's ETag & LastModified properties
}
type BlobHierarchyListSegment ¶
type BlobHierarchyListSegment struct { // REQUIRED BlobItems []*BlobItemInternal `xml:"Blob"` BlobPrefixes []*BlobPrefix `xml:"BlobPrefix"` }
func (BlobHierarchyListSegment) MarshalXML ¶
func (b BlobHierarchyListSegment) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaller interface for type BlobHierarchyListSegment.
type BlobItemInternal ¶
type BlobItemInternal struct { // REQUIRED Deleted *bool `xml:"Deleted"` // REQUIRED Name *string `xml:"Name"` // REQUIRED; Properties of a blob Properties *BlobPropertiesInternal `xml:"Properties"` // REQUIRED Snapshot *string `xml:"Snapshot"` // Blob tags BlobTags *BlobTags `xml:"Tags"` IsCurrentVersion *bool `xml:"IsCurrentVersion"` Metadata *BlobMetadata `xml:"Metadata"` // Dictionary of ObjectReplicationMetadata map[string]*string `xml:"ObjectReplicationMetadata"` VersionID *string `xml:"VersionId"` }
BlobItemInternal - An Azure Storage blob
func (*BlobItemInternal) UnmarshalXML ¶
func (b *BlobItemInternal) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaller interface for type BlobItemInternal.
type BlobLeaseClient ¶
type BlobLeaseClient struct { BlobClient // contains filtered or unexported fields }
func (*BlobLeaseClient) AcquireLease ¶
func (blc *BlobLeaseClient) AcquireLease(ctx context.Context, options *AcquireLeaseBlobOptions) (BlobAcquireLeaseResponse, error)
AcquireLease acquires a lease on the blob for write and delete operations. The lease Duration must be between 15 to 60 seconds, or infinite (-1). For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob.
func (*BlobLeaseClient) BreakLease ¶
func (blc *BlobLeaseClient) BreakLease(ctx context.Context, options *BreakLeaseBlobOptions) (BlobBreakLeaseResponse, error)
BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant to break a fixed-Duration lease when it expires or an infinite lease immediately. For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob.
func (*BlobLeaseClient) ChangeLease ¶
func (blc *BlobLeaseClient) ChangeLease(ctx context.Context, options *ChangeLeaseBlobOptions) (BlobChangeLeaseResponse, error)
ChangeLease changes the blob's lease ID. For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob.
func (*BlobLeaseClient) ReleaseLease ¶
func (blc *BlobLeaseClient) ReleaseLease(ctx context.Context, options *ReleaseLeaseBlobOptions) (BlobReleaseLeaseResponse, error)
ReleaseLease releases the blob's previously-acquired lease. For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob.
func (*BlobLeaseClient) RenewLease ¶
func (blc *BlobLeaseClient) RenewLease(ctx context.Context, options *RenewLeaseBlobOptions) (BlobRenewLeaseResponse, error)
RenewLease renews the blob's previously-acquired lease. For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob.
type BlobMetadata ¶
type BlobMetadata struct { // OPTIONAL; Contains additional key/value pairs not defined in the schema. AdditionalProperties map[string]*string Encrypted *string `xml:"Encrypted,attr"` }
type BlobPrefix ¶
type BlobPrefix struct { // REQUIRED Name *string `xml:"Name"` }
type BlobPropertiesInternal ¶
type BlobPropertiesInternal struct { // REQUIRED Etag *string `xml:"Etag"` // REQUIRED LastModified *time.Time `xml:"Last-Modified"` AccessTier *AccessTier `xml:"AccessTier"` AccessTierChangeTime *time.Time `xml:"AccessTierChangeTime"` AccessTierInferred *bool `xml:"AccessTierInferred"` ArchiveStatus *ArchiveStatus `xml:"ArchiveStatus"` BlobSequenceNumber *int64 `xml:"x-ms-blob-sequence-number"` BlobType *BlobType `xml:"BlobType"` CacheControl *string `xml:"Cache-Control"` ContentDisposition *string `xml:"Content-Disposition"` ContentEncoding *string `xml:"Content-Encoding"` ContentLanguage *string `xml:"Content-Language"` // Size in bytes ContentLength *int64 `xml:"Content-Length"` ContentMD5 []byte `xml:"Content-MD5"` ContentType *string `xml:"Content-Type"` CopyCompletionTime *time.Time `xml:"CopyCompletionTime"` CopyID *string `xml:"CopyId"` CopyProgress *string `xml:"CopyProgress"` CopySource *string `xml:"CopySource"` CopyStatus *CopyStatusType `xml:"CopyStatus"` CopyStatusDescription *string `xml:"CopyStatusDescription"` CreationTime *time.Time `xml:"Creation-Time"` CustomerProvidedKeySHA256 *string `xml:"CustomerProvidedKeySha256"` DeletedTime *time.Time `xml:"DeletedTime"` DestinationSnapshot *string `xml:"DestinationSnapshot"` // The name of the encryption scope under which the blob is encrypted. EncryptionScope *string `xml:"EncryptionScope"` ExpiresOn *time.Time `xml:"Expiry-Time"` IncrementalCopy *bool `xml:"IncrementalCopy"` IsSealed *bool `xml:"Sealed"` LeaseDuration *LeaseDurationType `xml:"LeaseDuration"` LeaseState *LeaseStateType `xml:"LeaseState"` LeaseStatus *LeaseStatusType `xml:"LeaseStatus"` // If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High and Standard. RehydratePriority *RehydratePriority `xml:"RehydratePriority"` RemainingRetentionDays *int32 `xml:"RemainingRetentionDays"` ServerEncrypted *bool `xml:"ServerEncrypted"` TagCount *int32 `xml:"TagCount"` }
BlobPropertiesInternal - Properties of a blob
func (BlobPropertiesInternal) MarshalXML ¶
func (b BlobPropertiesInternal) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaller interface for type BlobPropertiesInternal.
func (*BlobPropertiesInternal) UnmarshalXML ¶
func (b *BlobPropertiesInternal) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaller interface for type BlobPropertiesInternal.
type BlobQueryOptions ¶
type BlobQueryOptions struct { // the query request QueryRequest *QueryRequest // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with // blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot // of a Blob.</a> Snapshot *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobQueryOptions contains the optional parameters for the Blob.Query method.
type BlobQueryResponse ¶
type BlobQueryResponse struct { BlobQueryResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobQueryResponse contains the response from method Blob.Query.
type BlobQueryResult ¶
type BlobQueryResult struct { // AcceptRanges contains the information returned from the Accept-Ranges header response. AcceptRanges *string // BlobCommittedBlockCount contains the information returned from the x-ms-blob-committed-block-count header response. BlobCommittedBlockCount *int32 // BlobContentMD5 contains the information returned from the x-ms-blob-content-md5 header response. BlobContentMD5 []byte // BlobSequenceNumber contains the information returned from the x-ms-blob-sequence-number header response. BlobSequenceNumber *int64 // BlobType contains the information returned from the x-ms-blob-type header response. BlobType *BlobType // CacheControl contains the information returned from the Cache-Control header response. CacheControl *string // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentCRC64 contains the information returned from the x-ms-content-crc64 header response. ContentCRC64 []byte // ContentDisposition contains the information returned from the Content-Disposition header response. ContentDisposition *string // ContentEncoding contains the information returned from the Content-Encoding header response. ContentEncoding *string // ContentLanguage contains the information returned from the Content-Language header response. ContentLanguage *string // ContentLength contains the information returned from the Content-Length header response. ContentLength *int64 // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // ContentRange contains the information returned from the Content-Range header response. ContentRange *string // ContentType contains the information returned from the Content-Type header response. ContentType *string // CopyCompletionTime contains the information returned from the x-ms-copy-completion-time header response. CopyCompletionTime *time.Time // CopyID contains the information returned from the x-ms-copy-id header response. CopyID *string // CopyProgress contains the information returned from the x-ms-copy-progress header response. CopyProgress *string // CopySource contains the information returned from the x-ms-copy-source header response. CopySource *string // CopyStatus contains the information returned from the x-ms-copy-status header response. CopyStatus *CopyStatusType // CopyStatusDescription contains the information returned from the x-ms-copy-status-description header response. CopyStatusDescription *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // IsServerEncrypted contains the information returned from the x-ms-server-encrypted header response. IsServerEncrypted *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // LeaseDuration contains the information returned from the x-ms-lease-duration header response. LeaseDuration *LeaseDurationType // LeaseState contains the information returned from the x-ms-lease-state header response. LeaseState *LeaseStateType // LeaseStatus contains the information returned from the x-ms-lease-status header response. LeaseStatus *LeaseStatusType // Metadata contains the information returned from the x-ms-meta header response. Metadata map[string]string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobQueryResult contains the result from method Blob.Query.
type BlobReleaseLeaseOptions ¶
type BlobReleaseLeaseOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobReleaseLeaseOptions contains the optional parameters for the Blob.ReleaseLease method.
type BlobReleaseLeaseResponse ¶
type BlobReleaseLeaseResponse struct { BlobReleaseLeaseResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobReleaseLeaseResponse contains the response from method Blob.ReleaseLease.
type BlobReleaseLeaseResult ¶
type BlobReleaseLeaseResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobReleaseLeaseResult contains the result from method Blob.ReleaseLease.
type BlobRenameOptions ¶
type BlobRenameOptions struct { // Optional. User-defined properties to be stored with the file or directory, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, // ...", where each value is base64 encoded. DirectoryProperties *string // Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, // and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal // notation (e.g. 0766) are supported. PosixPermissions *string // Only valid if Hierarchical Namespace is enabled for the account. This umask restricts permission settings for file and directory, and will only be applied // when default Acl does not exist in parent directory. If the umask bit has set, it means that the corresponding permission will be disabled. Otherwise // the corresponding permission will be determined by the permission. A 4-digit octal notation (e.g. 0022) is supported here. If no umask was specified, // a default umask - 0027 will be used. PosixUmask *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. SourceLeaseID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobRenameOptions contains the optional parameters for the Blob.Rename method.
type BlobRenameResponse ¶
type BlobRenameResponse struct { BlobRenameResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobRenameResponse contains the response from method Blob.Rename.
type BlobRenameResult ¶
type BlobRenameResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentLength contains the information returned from the Content-Length header response. ContentLength *int64 // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobRenameResult contains the result from method Blob.Rename.
type BlobRenewLeaseOptions ¶
type BlobRenewLeaseOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobRenewLeaseOptions contains the optional parameters for the Blob.RenewLease method.
type BlobRenewLeaseResponse ¶
type BlobRenewLeaseResponse struct { BlobRenewLeaseResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobRenewLeaseResponse contains the response from method Blob.RenewLease.
type BlobRenewLeaseResult ¶
type BlobRenewLeaseResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // LeaseID contains the information returned from the x-ms-lease-id header response. LeaseID *string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobRenewLeaseResult contains the result from method Blob.RenewLease.
type BlobSASPermissions ¶
type BlobSASPermissions struct{ Read, Add, Create, Write, Delete, DeletePreviousVersion bool }
The BlobSASPermissions type simplifies creating the permissions string for an Azure Storage blob SAS. Initialize an instance of this type and then call its String method to set BlobSASSignatureValues's Permissions field.
func (*BlobSASPermissions) Parse ¶
func (p *BlobSASPermissions) Parse(s string) error
Parse initializes the BlobSASPermissions's fields from a string.
func (BlobSASPermissions) String ¶
func (p BlobSASPermissions) String() string
String produces the SAS permissions string for an Azure Storage blob. Call this method to set BlobSASSignatureValues's Permissions field.
type BlobSASSignatureValues ¶
type BlobSASSignatureValues struct { Version string `param:"sv"` // If not specified, this defaults to SASVersion Protocol SASProtocol `param:"spr"` // See the SASProtocol* constants StartTime time.Time `param:"st"` // Not specified if IsZero ExpiryTime time.Time `param:"se"` // Not specified if IsZero SnapshotTime time.Time Permissions string `param:"sp"` // Create by initializing a ContainerSASPermissions or BlobSASPermissions and then call String() IPRange IPRange `param:"sip"` Identifier string `param:"si"` ContainerName string BlobName string // Use "" to create a Container SAS CacheControl string // rscc ContentDisposition string // rscd ContentEncoding string // rsce ContentLanguage string // rscl ContentType string // rsct }
BlobSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage container or blob.
For more information, see https://docs.microsoft.com/rest/api/storageservices/constructing-a-service-sas
This example demonstrates how to create and use a Blob service Shared Access Signature (SAS)
Code:
Example¶
{
// Gather your account key and name from the Azure portal
// Supplying them via environment variables is recommended.
accountName, accountKey := accountInfo()
// Use your storage account's name and key to form a credential object
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
log.Fatal(err)
}
containerName := "myContainer"
blobName := "HelloWorld.txt"
sasQueryParams, err := BlobSASSignatureValues{
Protocol: SASProtocolHTTPS,
ExpiryTime: time.Now().UTC().Add(48 * time.Hour),
ContainerName: containerName,
BlobName: blobName,
// To produce a container SAS, as opposed to a blob SAS, assign to permissions using ContainerSASPermissions
// and make sure the BlobName field is ""
Permissions: BlobSASPermissions{Add: true, Read: true, Write: true}.String(),
}.NewSASQueryParameters(credential)
if err != nil {
log.Fatal(err)
}
// Create the URL of this resource you wish to access, and append the SAS query parameters.
// Since this is a blob SAS, the URL is to the Azure Storage blob.
qp := sasQueryParams.Encode()
urlToSendToSomeone := fmt.Sprintf("https://%s.blob.core.windows.net/%s/%s?%s",
accountName, containerName, blobName, qp)
// At this point, you can send the URL to someone via communication method of your choice, and it will provide
// anonymous access to the resource.
// **************
// When someone receives the URL, they can access the SAS-protected resource like this:
blob, _ := NewBlobClient(urlToSendToSomeone, azcore.NewAnonymousCredential(), nil)
// if you have a SAS query parameter string, you can parse it into it's parts.
blobURLParts := NewBlobURLParts(blob.URL())
fmt.Printf("SAS expiry time=%v", blobURLParts.SAS.ExpiryTime())
}
func (BlobSASSignatureValues) NewSASQueryParameters ¶
func (v BlobSASSignatureValues) NewSASQueryParameters(sharedKeyCredential *SharedKeyCredential) (SASQueryParameters, error)
NewSASQueryParameters uses an account's StorageAccountCredential to sign this signature values to produce the proper SAS query parameters. See: StorageAccountCredential. Compatible with both UserDelegationCredential and SharedKeyCredential
type BlobSetAccessControlOptions ¶
type BlobSetAccessControlOptions struct { // Optional. The owning group of the blob or directory. Group *string // Optional. The owner of the blob or directory. Owner *string // Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. Each access control entry (ACE) // consists of a scope, a type, a user or group identifier, and permissions in the format "[scope:][type]:[id]:[permissions]". PosixACL *string // Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, // and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal // notation (e.g. 0766) are supported. PosixPermissions *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobSetAccessControlOptions contains the optional parameters for the Blob.SetAccessControl method.
type BlobSetAccessControlResponse ¶
type BlobSetAccessControlResponse struct { BlobSetAccessControlResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobSetAccessControlResponse contains the response from method Blob.SetAccessControl.
type BlobSetAccessControlResult ¶
type BlobSetAccessControlResult struct { // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobSetAccessControlResult contains the result from method Blob.SetAccessControl.
type BlobSetExpiryOptions ¶
type BlobSetExpiryOptions struct { // The time to set the blob to expiry ExpiresOn *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobSetExpiryOptions contains the optional parameters for the Blob.SetExpiry method.
type BlobSetExpiryResponse ¶
type BlobSetExpiryResponse struct { BlobSetExpiryResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobSetExpiryResponse contains the response from method Blob.SetExpiry.
type BlobSetExpiryResult ¶
type BlobSetExpiryResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobSetExpiryResult contains the result from method Blob.SetExpiry.
type BlobSetHTTPHeadersOptions ¶
type BlobSetHTTPHeadersOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobSetHTTPHeadersOptions contains the optional parameters for the Blob.SetHTTPHeaders method.
type BlobSetHTTPHeadersResponse ¶
type BlobSetHTTPHeadersResponse struct { BlobSetHTTPHeadersResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobSetHTTPHeadersResponse contains the response from method Blob.SetHTTPHeaders.
type BlobSetHTTPHeadersResult ¶
type BlobSetHTTPHeadersResult struct { // BlobSequenceNumber contains the information returned from the x-ms-blob-sequence-number header response. BlobSequenceNumber *int64 // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobSetHTTPHeadersResult contains the result from method Blob.SetHTTPHeaders.
type BlobSetMetadataOptions ¶
type BlobSetMetadataOptions struct { // Optional. Specifies 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. Note that beginning with version 2009-09-19, metadata names must adhere to the naming // rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. Metadata map[string]string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobSetMetadataOptions contains the optional parameters for the Blob.SetMetadata method.
type BlobSetMetadataResponse ¶
type BlobSetMetadataResponse struct { BlobSetMetadataResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobSetMetadataResponse contains the response from method Blob.SetMetadata.
type BlobSetMetadataResult ¶
type BlobSetMetadataResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. IsServerEncrypted *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // VersionID contains the information returned from the x-ms-version-id header response. VersionID *string }
BlobSetMetadataResult contains the result from method Blob.SetMetadata.
type BlobSetTagsOptions ¶
type BlobSetTagsOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // Blob tags Tags *BlobTags // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // Specify the transactional crc64 for the body, to be validated by the service. TransactionalContentCRC64 []byte // Specify the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 []byte // The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 // and newer. VersionID *string }
BlobSetTagsOptions contains the optional parameters for the Blob.SetTags method.
type BlobSetTagsResponse ¶
type BlobSetTagsResponse struct { BlobSetTagsResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobSetTagsResponse contains the response from method Blob.SetTags.
type BlobSetTagsResult ¶
type BlobSetTagsResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobSetTagsResult contains the result from method Blob.SetTags.
type BlobSetTierOptions ¶
type BlobSetTierOptions struct { // Optional: Indicates the priority with which to rehydrate an archived blob. RehydratePriority *RehydratePriority // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with // blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot // of a Blob.</a> Snapshot *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 // and newer. VersionID *string }
BlobSetTierOptions contains the optional parameters for the Blob.SetTier method.
type BlobSetTierResponse ¶
type BlobSetTierResponse struct { BlobSetTierResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobSetTierResponse contains the response from method Blob.SetTier.
type BlobSetTierResult ¶
type BlobSetTierResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobSetTierResult contains the result from method Blob.SetTier.
type BlobStartCopyFromURLOptions ¶
type BlobStartCopyFromURLOptions struct { // Optional. Used to set blob tags in various blob operations. BlobTagsString *string // Optional. Specifies 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. Note that beginning with version 2009-09-19, metadata names must adhere to the naming // rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. Metadata map[string]string // Optional: Indicates the priority with which to rehydrate an archived blob. RehydratePriority *RehydratePriority // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer. SealBlob *bool // Optional. Indicates the tier to be set on the blob. Tier *AccessTier // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobStartCopyFromURLOptions contains the optional parameters for the Blob.StartCopyFromURL method.
type BlobStartCopyFromURLResponse ¶
type BlobStartCopyFromURLResponse struct { BlobStartCopyFromURLResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobStartCopyFromURLResponse contains the response from method Blob.StartCopyFromURL.
type BlobStartCopyFromURLResult ¶
type BlobStartCopyFromURLResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // CopyID contains the information returned from the x-ms-copy-id header response. CopyID *string // CopyStatus contains the information returned from the x-ms-copy-status header response. CopyStatus *CopyStatusType // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // VersionID contains the information returned from the x-ms-version-id header response. VersionID *string }
BlobStartCopyFromURLResult contains the result from method Blob.StartCopyFromURL.
type BlobTag ¶
type BlobTags ¶
type BlobTags struct { // REQUIRED BlobTagSet []*BlobTag `xml:"TagSet>Tag"` }
BlobTags - Blob tags
func (BlobTags) MarshalXML ¶
MarshalXML implements the xml.Marshaller interface for type BlobTags.
type BlobType ¶
type BlobType string
const ( BlobTypeBlockBlob BlobType = "BlockBlob" BlobTypePageBlob BlobType = "PageBlob" BlobTypeAppendBlob BlobType = "AppendBlob" )
func PossibleBlobTypeValues ¶
func PossibleBlobTypeValues() []BlobType
PossibleBlobTypeValues returns the possible values for the BlobType const type.
func (BlobType) ToPtr ¶
ToPtr returns a *BlobType pointing to the current value.
type BlobURLParts ¶
type BlobURLParts struct { Scheme string // Ex: "https://" Host string // Ex: "account.blob.core.windows.net", "10.132.141.33", "10.132.141.33:80" IPEndpointStyleInfo IPEndpointStyleInfo ContainerName string // "" if no container BlobName string // "" if no blob Snapshot string // "" if not a snapshot SAS SASQueryParameters UnparsedParams string VersionID string // "" if not versioning enabled }
A BlobURLParts object represents the components that make up an Azure Storage Container/Blob URL. You parse an
existing URL into its parts by calling NewBlobURLParts(). You construct a URL from parts by calling URL().
NOTE: Changing any SAS-related field requires computing a new SAS signature.
This example demonstrates splitting a URL into its parts so you can examine and modify the URL in an Azure Storage fluent way.
Code:
Example¶
{
// Let's begin with a snapshot SAS token.
u := "https://myaccount.blob.core.windows.net/mycontainter/ReadMe.txt?" +
"snapshot=2011-03-09T01:42:34Z&" +
"sv=2015-02-21&sr=b&st=2111-01-09T01:42:34.936Z&se=2222-03-09T01:42:34.936Z&sp=rw&sip=168.1.5.60-168.1.5.70&" +
"spr=https,http&si=myIdentifier&ss=bf&srt=s&sig=92836758923659283652983562=="
// Breaking the URL down into it's parts by conversion to BlobURLParts
parts := NewBlobURLParts(u)
// Now, we can access the parts (this example prints them.)
fmt.Println(parts.Host, parts.ContainerName, parts.BlobName, parts.Snapshot)
sas := parts.SAS
fmt.Println(sas.Version(), sas.Resource(), sas.StartTime(), sas.ExpiryTime(), sas.Permissions(),
sas.IPRange(), sas.Protocol(), sas.Identifier(), sas.Services(), sas.Signature())
// You can also alter some of the fields and construct a new URL:
// Note that: SAS tokens may be limited to a specific container or blob.
// You should be careful about modifying SAS tokens, as you might take them outside of their original scope accidentally.
parts.SAS = SASQueryParameters{}
parts.Snapshot = ""
parts.ContainerName = "othercontainer"
// construct a new URL from the parts
fmt.Print(parts.URL())
}
func NewBlobURLParts ¶
func NewBlobURLParts(u string) BlobURLParts
NewBlobURLParts parses a URL initializing BlobURLParts' fields including any SAS-related & snapshot query parameters. Any other query parameters remain in the UnparsedParams field. This method overwrites all fields in the BlobURLParts object.
func (BlobURLParts) URL ¶
func (up BlobURLParts) URL() string
URL returns a URL object whose fields are initialized from the BlobURLParts fields. The URL's RawQuery field contains the SAS, snapshot, and unparsed query parameters.
type BlobUndeleteOptions ¶
type BlobUndeleteOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlobUndeleteOptions contains the optional parameters for the Blob.Undelete method.
type BlobUndeleteResponse ¶
type BlobUndeleteResponse struct { BlobUndeleteResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlobUndeleteResponse contains the response from method Blob.Undelete.
type BlobUndeleteResult ¶
type BlobUndeleteResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
BlobUndeleteResult contains the result from method Blob.Undelete.
type Block ¶
type Block struct { // REQUIRED; The base64 encoded block ID. Name *string `xml:"Name"` // REQUIRED; The block size in bytes. Size *int64 `xml:"Size"` }
Block - Represents a single block in a block blob. It describes the block's ID and size.
type BlockBlobClient ¶
type BlockBlobClient struct { BlobClient // contains filtered or unexported fields }
BlockBlobClient defines a set of operations applicable to block blobs.
ExampleBlockBlobClient shows how to upload a lot of data (in blocks) to a blob.
A block blob can have a maximum of 50,000 blocks; each block can have a maximum of 100MB.
Therefore, the maximum size of a block blob is slightly more than 4.75 TB (100 MB X 50,000 blocks).
Code:
Example¶
{
// From the Azure portal, get your Storage account blob service URL endpoint.
accountName, accountKey := accountInfo()
// Create a ContainerClient object that wraps a soon-to-be-created blob's URL and a default pipeline.
u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/MyBlockBlob.txt", accountName)
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
log.Fatal(err)
}
BlobClient, err := NewBlockBlobClient(u, credential, nil)
if err != nil {
log.Fatal(err)
}
ctx := context.Background() // This example uses a never-expiring context
// These helper functions convert a binary block ID to a base-64 string and vice versa
// NOTE: The blockID must be <= 64 bytes and ALL blockIDs for the block must be the same length
blockIDBinaryToBase64 := func(blockID []byte) string { return base64.StdEncoding.EncodeToString(blockID) }
blockIDBase64ToBinary := func(blockID string) []byte { _binary, _ := base64.StdEncoding.DecodeString(blockID); return _binary }
// These helper functions convert an int block ID to a base-64 string and vice versa
blockIDIntToBase64 := func(blockID int) string {
binaryBlockID := (&[4]byte{})[:] // All block IDs are 4 bytes long
binary.LittleEndian.PutUint32(binaryBlockID, uint32(blockID))
return blockIDBinaryToBase64(binaryBlockID)
}
blockIDBase64ToInt := func(blockID string) int {
blockIDBase64ToBinary(blockID)
return int(binary.LittleEndian.Uint32(blockIDBase64ToBinary(blockID)))
}
// Upload 4 blocks to the blob (these blocks are tiny; they can be up to 100MB each)
words := []string{"Azure ", "Storage ", "Block ", "Blob."}
base64BlockIDs := make([]string, len(words)) // The collection of block IDs (base 64 strings)
// Upload each block sequentially (one after the other); for better performance, you want to upload multiple blocks in parallel)
for index, word := range words {
// This example uses the index as the block ID; convert the index/ID into a base-64 encoded string as required by the service.
// NOTE: Over the lifetime of a blob, all block IDs (before base 64 encoding) must be the same length (this example uses 4 byte block IDs).
base64BlockIDs[index] = blockIDIntToBase64(index) // Some people use UUIDs for block IDs
// Upload a block to this blob specifying the Block ID and its content (up to 100MB); this block is uncommitted.
_, err := BlobClient.StageBlock(ctx, base64BlockIDs[index], NopCloser(strings.NewReader(word)), nil)
if err != nil {
log.Fatal(err)
}
}
// After all the blocks are uploaded, atomically commit them to the blob.
_, err = BlobClient.CommitBlockList(ctx, base64BlockIDs, nil)
if err != nil {
log.Fatal(err)
}
// For the blob, show each block (ID and size) that is a committed part of it.
getBlock, err := BlobClient.GetBlockList(ctx, BlockListTypeAll, nil)
if err != nil {
log.Fatal(err)
}
for _, block := range getBlock.BlockList.CommittedBlocks {
fmt.Printf("Block ID=%d, Size=%d\n", blockIDBase64ToInt(*block.Name), block.Size)
}
// Download the blob in its entirety; download operations do not take blocks into account.
// NOTE: For really large blobs, downloading them like allocates a lot of memory.
get, err := BlobClient.Download(ctx, nil)
if err != nil {
log.Fatal(err)
}
blobData := &bytes.Buffer{}
reader := get.Body(RetryReaderOptions{})
_, err = blobData.ReadFrom(reader)
if err != nil {
return
}
err = reader.Close()
if err != nil {
return
} // The client must close the response body when finished with it
fmt.Println(blobData)
}
func NewBlockBlobClient ¶
func NewBlockBlobClient(blobURL string, cred azcore.Credential, options *ClientOptions) (BlockBlobClient, error)
NewBlockBlobClient creates a BlockBlobClient object using the specified URL and request policy pipeline.
func (BlockBlobClient) CommitBlockList ¶
func (bb BlockBlobClient) CommitBlockList(ctx context.Context, base64BlockIDs []string, options *CommitBlockListOptions) (BlockBlobCommitBlockListResponse, error)
CommitBlockList 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 PutBlock operation. You can call PutBlockList to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. Any blocks not specified in the block list and permanently deleted. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-block-list.
func (BlockBlobClient) CopyFromURL ¶
func (bb BlockBlobClient) CopyFromURL(ctx context.Context, source string, options *CopyBlockBlobFromURLOptions) (BlobCopyFromURLResponse, error)
CopyFromURL synchronously copies the data at the source URL to a block blob, with sizes up to 256 MB. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/copy-blob-from-url.
func (BlockBlobClient) GetBlockList ¶
func (bb BlockBlobClient) GetBlockList(ctx context.Context, listType BlockListType, options *GetBlockListOptions) (BlockBlobGetBlockListResponse, error)
GetBlockList returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-block-list.
func (BlockBlobClient) StageBlock ¶
func (bb BlockBlobClient) StageBlock(ctx context.Context, base64BlockID string, body io.ReadSeekCloser, options *StageBlockOptions) (BlockBlobStageBlockResponse, error)
StageBlock uploads the specified block to the block blob's "staging area" to be later committed by a call to CommitBlockList. Note that the http client closes the body stream after the request is sent to the service. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-block.
func (BlockBlobClient) StageBlockFromURL ¶
func (bb BlockBlobClient) StageBlockFromURL(ctx context.Context, base64BlockID string, sourceURL string, contentLength int64, options *StageBlockFromURLOptions) (BlockBlobStageBlockFromURLResponse, error)
StageBlockFromURL copies the specified block from a source URL to the block blob's "staging area" to be later committed by a call to CommitBlockList. If count is CountToEnd (0), then data is read from specified offset to the end. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/put-block-from-url.
func (BlockBlobClient) Upload ¶
func (bb BlockBlobClient) Upload(ctx context.Context, body io.ReadSeekCloser, options *UploadBlockBlobOptions) (BlockBlobUploadResponse, error)
Upload creates a new block blob or overwrites an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not supported with Upload; the content of the existing blob is overwritten with the new content. To perform a partial update of a block blob, use StageBlock and CommitBlockList. This method panics if the stream is not at position 0. Note that the http client closes the body stream after the request is sent to the service. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.
func (BlockBlobClient) UploadBufferToBlockBlob ¶
func (bb BlockBlobClient) UploadBufferToBlockBlob(ctx context.Context, b []byte, o HighLevelUploadToBlockBlobOption) (*http.Response, error)
UploadBufferToBlockBlob uploads a buffer in blocks to a block blob.
func (BlockBlobClient) UploadFileToBlockBlob ¶
func (bb BlockBlobClient) UploadFileToBlockBlob(ctx context.Context, file *os.File, o HighLevelUploadToBlockBlobOption) (*http.Response, error)
UploadFileToBlockBlob uploads a file in blocks to a block blob.
func (BlockBlobClient) UploadStreamToBlockBlob ¶
func (bb BlockBlobClient) UploadStreamToBlockBlob(ctx context.Context, body io.ReadSeekCloser, o UploadStreamToBlockBlobOptions) (BlockBlobCommitBlockListResponse, error)
UploadStreamToBlockBlob copies the file held in io.Reader to the Blob at blockBlobClient. A Context deadline or cancellation will cause this to error.
func (BlockBlobClient) WithSnapshot ¶
func (bb BlockBlobClient) WithSnapshot(snapshot string) BlockBlobClient
WithSnapshot creates a new BlockBlobClient object identical to the source but with the specified snapshot timestamp. Pass "" to remove the snapshot returning a URL to the base blob.
func (BlockBlobClient) WithVersionID ¶
func (bb BlockBlobClient) WithVersionID(versionID string) BlockBlobClient
WithVersionID creates a new AppendBlobURL object identical to the source but with the specified version id. Pass "" to remove the versionID returning a URL to the base blob.
type BlockBlobCommitBlockListOptions ¶
type BlockBlobCommitBlockListOptions struct { // Optional. Used to set blob tags in various blob operations. BlobTagsString *string // Optional. Specifies 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. Note that beginning with version 2009-09-19, metadata names must adhere to the naming // rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. Metadata map[string]string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // Optional. Indicates the tier to be set on the blob. Tier *AccessTier // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // Specify the transactional crc64 for the body, to be validated by the service. TransactionalContentCRC64 []byte // Specify the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 []byte }
BlockBlobCommitBlockListOptions contains the optional parameters for the BlockBlob.CommitBlockList method.
type BlockBlobCommitBlockListResponse ¶
type BlockBlobCommitBlockListResponse struct { BlockBlobCommitBlockListResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlockBlobCommitBlockListResponse contains the response from method BlockBlob.CommitBlockList.
type BlockBlobCommitBlockListResult ¶
type BlockBlobCommitBlockListResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. IsServerEncrypted *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // VersionID contains the information returned from the x-ms-version-id header response. VersionID *string // XMSContentCRC64 contains the information returned from the x-ms-content-crc64 header response. XMSContentCRC64 []byte }
BlockBlobCommitBlockListResult contains the result from method BlockBlob.CommitBlockList.
type BlockBlobGetBlockListOptions ¶
type BlockBlobGetBlockListOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with // blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot // of a Blob.</a> Snapshot *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlockBlobGetBlockListOptions contains the optional parameters for the BlockBlob.GetBlockList method.
type BlockBlobGetBlockListResponse ¶
type BlockBlobGetBlockListResponse struct { BlockBlobGetBlockListResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlockBlobGetBlockListResponse contains the response from method BlockBlob.GetBlockList.
type BlockBlobGetBlockListResult ¶
type BlockBlobGetBlockListResult struct { BlockList // BlobContentLength contains the information returned from the x-ms-blob-content-length header response. BlobContentLength *int64 `xml:"BlobContentLength"` // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string `xml:"ClientRequestID"` // ContentType contains the information returned from the Content-Type header response. ContentType *string `xml:"ContentType"` // Date contains the information returned from the Date header response. Date *time.Time `xml:"Date"` // ETag contains the information returned from the ETag header response. ETag *string `xml:"ETag"` // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time `xml:"LastModified"` // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string `xml:"RequestID"` // Version contains the information returned from the x-ms-version header response. Version *string `xml:"Version"` }
BlockBlobGetBlockListResult contains the result from method BlockBlob.GetBlockList.
type BlockBlobStageBlockFromURLOptions ¶
type BlockBlobStageBlockFromURLOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // Specify the md5 calculated for the range of bytes that must be read from the copy source. SourceContentMD5 []byte // Specify the crc64 calculated for the range of bytes that must be read from the copy source. SourceContentcrc64 []byte // Bytes of source data in the specified range. SourceRange *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
BlockBlobStageBlockFromURLOptions contains the optional parameters for the BlockBlob.StageBlockFromURL method.
type BlockBlobStageBlockFromURLResponse ¶
type BlockBlobStageBlockFromURLResponse struct { BlockBlobStageBlockFromURLResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlockBlobStageBlockFromURLResponse contains the response from method BlockBlob.StageBlockFromURL.
type BlockBlobStageBlockFromURLResult ¶
type BlockBlobStageBlockFromURLResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // Date contains the information returned from the Date header response. Date *time.Time // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. IsServerEncrypted *bool // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // XMSContentCRC64 contains the information returned from the x-ms-content-crc64 header response. XMSContentCRC64 []byte }
BlockBlobStageBlockFromURLResult contains the result from method BlockBlob.StageBlockFromURL.
type BlockBlobStageBlockOptions ¶
type BlockBlobStageBlockOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // Specify the transactional crc64 for the body, to be validated by the service. TransactionalContentCRC64 []byte // Specify the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 []byte }
BlockBlobStageBlockOptions contains the optional parameters for the BlockBlob.StageBlock method.
type BlockBlobStageBlockResponse ¶
type BlockBlobStageBlockResponse struct { BlockBlobStageBlockResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlockBlobStageBlockResponse contains the response from method BlockBlob.StageBlock.
type BlockBlobStageBlockResult ¶
type BlockBlobStageBlockResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // Date contains the information returned from the Date header response. Date *time.Time // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. IsServerEncrypted *bool // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // XMSContentCRC64 contains the information returned from the x-ms-content-crc64 header response. XMSContentCRC64 []byte }
BlockBlobStageBlockResult contains the result from method BlockBlob.StageBlock.
type BlockBlobUploadOptions ¶
type BlockBlobUploadOptions struct { // Optional. Used to set blob tags in various blob operations. BlobTagsString *string // Optional. Specifies 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. Note that beginning with version 2009-09-19, metadata names must adhere to the naming // rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. Metadata map[string]string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // Optional. Indicates the tier to be set on the blob. Tier *AccessTier // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // Specify the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 []byte }
BlockBlobUploadOptions contains the optional parameters for the BlockBlob.Upload method.
type BlockBlobUploadResponse ¶
type BlockBlobUploadResponse struct { BlockBlobUploadResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
BlockBlobUploadResponse contains the response from method BlockBlob.Upload.
type BlockBlobUploadResult ¶
type BlockBlobUploadResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. IsServerEncrypted *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // VersionID contains the information returned from the x-ms-version-id header response. VersionID *string }
BlockBlobUploadResult contains the result from method BlockBlob.Upload.
type BlockList ¶
type BlockList struct { CommittedBlocks []*Block `xml:"CommittedBlocks>Block"` UncommittedBlocks []*Block `xml:"UncommittedBlocks>Block"` }
func (BlockList) MarshalXML ¶
MarshalXML implements the xml.Marshaller interface for type BlockList.
type BlockListType ¶
type BlockListType string
const ( BlockListTypeCommitted BlockListType = "committed" BlockListTypeUncommitted BlockListType = "uncommitted" BlockListTypeAll BlockListType = "all" )
func PossibleBlockListTypeValues ¶
func PossibleBlockListTypeValues() []BlockListType
PossibleBlockListTypeValues returns the possible values for the BlockListType const type.
func (BlockListType) ToPtr ¶
func (c BlockListType) ToPtr() *BlockListType
ToPtr returns a *BlockListType pointing to the current value.
type BlockLookupList ¶
type BlockLookupList struct { Committed []*string `xml:"Committed"` Latest []*string `xml:"Latest"` Uncommitted []*string `xml:"Uncommitted"` }
func (BlockLookupList) MarshalXML ¶
func (b BlockLookupList) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaller interface for type BlockLookupList.
type BreakLeaseBlobOptions ¶
type BreakLeaseBlobOptions 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 *int32 ModifiedAccessConditions *ModifiedAccessConditions }
type BreakLeaseContainerOptions ¶
type BreakLeaseContainerOptions struct { BreakPeriod *int32 ModifiedAccessConditions *ModifiedAccessConditions }
type ChangeLeaseBlobOptions ¶
type ChangeLeaseBlobOptions struct { ProposedLeaseID *string ModifiedAccessConditions *ModifiedAccessConditions }
type ChangeLeaseContainerOptions ¶
type ChangeLeaseContainerOptions struct { ProposedLeaseID *string ModifiedAccessConditions *ModifiedAccessConditions }
type ClearPagesOptions ¶
type ClearPagesOptions struct { CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo SequenceNumberAccessConditions *SequenceNumberAccessConditions BlobAccessConditions *BlobAccessConditions }
type ClearRange ¶
type ClearRange struct { // REQUIRED End *int64 `xml:"End"` // REQUIRED Start *int64 `xml:"Start"` }
type ClientOptions ¶
type ClientOptions struct { // Transporter sets the transport for making HTTP requests. Transporter policy.Transporter // Retry configures the built-in retry policy behavior. Retry policy.RetryOptions // Telemetry configures the built-in telemetry policy behavior. Telemetry policy.TelemetryOptions // PerCallOptions are options to run on every request PerCallOptions []policy.Policy }
type CommitBlockListOptions ¶
type CommitBlockListOptions struct { BlobTagsMap map[string]string Metadata map[string]string RequestID *string Tier *AccessTier Timeout *int32 TransactionalContentCRC64 []byte TransactionalContentMD5 []byte BlobHTTPHeaders *BlobHTTPHeaders CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo BlobAccessConditions *BlobAccessConditions }
type ContainerAccessConditions ¶
type ContainerAccessConditions struct { ModifiedAccessConditions *ModifiedAccessConditions LeaseAccessConditions *LeaseAccessConditions }
ContainerAccessConditions identifies container-specific access conditions which you optionally set.
type ContainerAcquireLeaseOptions ¶
type ContainerAcquireLeaseOptions struct { // 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. // A lease duration cannot be changed using renew or change. Duration *int32 // Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See // Guid Constructor (String) for a list of valid GUID string formats. ProposedLeaseID *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerAcquireLeaseOptions contains the optional parameters for the Container.AcquireLease method.
type ContainerAcquireLeaseResponse ¶
type ContainerAcquireLeaseResponse struct { ContainerAcquireLeaseResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerAcquireLeaseResponse contains the response from method Container.AcquireLease.
type ContainerAcquireLeaseResult ¶
type ContainerAcquireLeaseResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // LeaseID contains the information returned from the x-ms-lease-id header response. LeaseID *string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
ContainerAcquireLeaseResult contains the result from method Container.AcquireLease.
type ContainerBreakLeaseOptions ¶
type ContainerBreakLeaseOptions 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 *int32 // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerBreakLeaseOptions contains the optional parameters for the Container.BreakLease method.
type ContainerBreakLeaseResponse ¶
type ContainerBreakLeaseResponse struct { ContainerBreakLeaseResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerBreakLeaseResponse contains the response from method Container.BreakLease.
type ContainerBreakLeaseResult ¶
type ContainerBreakLeaseResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // LeaseTime contains the information returned from the x-ms-lease-time header response. LeaseTime *int32 // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
ContainerBreakLeaseResult contains the result from method Container.BreakLease.
type ContainerChangeLeaseOptions ¶
type ContainerChangeLeaseOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerChangeLeaseOptions contains the optional parameters for the Container.ChangeLease method.
type ContainerChangeLeaseResponse ¶
type ContainerChangeLeaseResponse struct { ContainerChangeLeaseResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerChangeLeaseResponse contains the response from method Container.ChangeLease.
type ContainerChangeLeaseResult ¶
type ContainerChangeLeaseResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // LeaseID contains the information returned from the x-ms-lease-id header response. LeaseID *string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
ContainerChangeLeaseResult contains the result from method Container.ChangeLease.
type ContainerClient ¶
type ContainerClient struct {
// contains filtered or unexported fields
}
A ContainerClient represents a URL to the Azure Storage container allowing you to manipulate its blobs.
func NewContainerClient ¶
func NewContainerClient(containerURL string, cred azcore.Credential, options *ClientOptions) (ContainerClient, error)
NewContainerClient creates a ContainerClient object using the specified URL and request policy pipeline.
func NewContainerClientFromConnectionString ¶
func NewContainerClientFromConnectionString(connectionString string, containerName string, options *ClientOptions) (ContainerClient, error)
NewContainerClientFromConnectionString creates a ContainerClient object using connection string of an account
func (ContainerClient) Create ¶
func (c ContainerClient) Create(ctx context.Context, options *CreateContainerOptions) (ContainerCreateResponse, error)
Create creates a new container within a storage account. If a container with the same name already exists, the operation fails. For more information, see https://docs.microsoft.com/rest/api/storageservices/create-container.
func (ContainerClient) Delete ¶
func (c ContainerClient) Delete(ctx context.Context, options *DeleteContainerOptions) (ContainerDeleteResponse, error)
Delete marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-container.
func (ContainerClient) GetAccessPolicy ¶
func (c ContainerClient) GetAccessPolicy(ctx context.Context, options *GetAccessPolicyOptions) (ContainerGetAccessPolicyResponse, error)
GetAccessPolicy returns the container's access policy. The access policy indicates whether container's blobs may be accessed publicly. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-container-acl.
func (ContainerClient) GetProperties ¶
func (c ContainerClient) GetProperties(ctx context.Context, gpo *GetPropertiesOptionsContainer) (ContainerGetPropertiesResponse, error)
GetProperties returns the container's properties. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-container-metadata.
func (ContainerClient) GetSASToken ¶
func (c ContainerClient) GetSASToken(permissions BlobSASPermissions, start time.Time, expiry time.Time) (SASQueryParameters, error)
GetSASToken is a convenience method for generating a SAS token for the currently pointed at container. It can only be used if the supplied azcore.Credential during creation was a SharedKeyCredential.
func (ContainerClient) ListBlobsFlat ¶
func (c ContainerClient) ListBlobsFlat(listOptions *ContainerListBlobFlatSegmentOptions) *ContainerListBlobFlatSegmentPager
ListBlobsFlat returns a pager for blobs starting from the specified Marker. Use an empty Marker to start enumeration from the beginning. Blob names are returned in lexicographic order. For more information, see https://docs.microsoft.com/rest/api/storageservices/list-blobs.
func (ContainerClient) ListBlobsHierarchy ¶
func (c ContainerClient) ListBlobsHierarchy(delimiter string, listOptions *ContainerListBlobHierarchySegmentOptions) *ContainerListBlobHierarchySegmentPager
ListBlobsHierarchy returns a channel of blobs starting from the specified Marker. Use an empty Marker to start enumeration from the beginning. Blob names are returned in lexicographic order. After getting a segment, process it, and then call ListBlobsHierarchicalSegment again (passing the the previously-returned Marker) to get the next segment. For more information, see https://docs.microsoft.com/rest/api/storageservices/list-blobs. AutoPagerTimeout specifies the amount of time with no read operations before the channel times out and closes. Specify no time and it will be ignored. AutoPagerBufferSize specifies the channel's buffer size. Both the blob item channel and error channel should be watched. Only one error will be released via this channel (or a nil error, to register a clean exit.)
func (ContainerClient) NewAppendBlobClient ¶
func (c ContainerClient) NewAppendBlobClient(blobName string) AppendBlobClient
NewAppendBlobClient creates a new AppendBlobURL object by concatenating blobName to the end of ContainerClient's URL. The new AppendBlobURL uses the same request policy pipeline as the ContainerClient. To change the pipeline, create the AppendBlobURL and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewAppendBlobClient instead of calling this object's NewAppendBlobClient method.
func (ContainerClient) NewBlobClient ¶
func (c ContainerClient) NewBlobClient(blobName string) BlobClient
NewBlobClient creates a new BlobClient object by concatenating blobName to the end of ContainerClient's URL. The new BlobClient uses the same request policy pipeline as the ContainerClient. To change the pipeline, create the BlobClient and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewBlobClient instead of calling this object's NewBlobClient method.
func (ContainerClient) NewBlockBlobClient ¶
func (c ContainerClient) NewBlockBlobClient(blobName string) BlockBlobClient
NewBlockBlobClient creates a new BlockBlobClient object by concatenating blobName to the end of ContainerClient's URL. The new BlockBlobClient uses the same request policy pipeline as the ContainerClient. To change the pipeline, create the BlockBlobClient and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewBlockBlobClient instead of calling this object's NewBlockBlobClient method.
func (ContainerClient) NewContainerLeaseClient ¶
func (c ContainerClient) NewContainerLeaseClient(leaseID *string) (ContainerLeaseClient, error)
func (ContainerClient) NewPageBlobClient ¶
func (c ContainerClient) NewPageBlobClient(blobName string) PageBlobClient
NewPageBlobClient creates a new PageBlobURL object by concatenating blobName to the end of ContainerClient's URL. The new PageBlobURL uses the same request policy pipeline as the ContainerClient. To change the pipeline, create the PageBlobURL and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewPageBlobClient instead of calling this object's NewPageBlobClient method.
func (ContainerClient) SetAccessPolicy ¶
func (c ContainerClient) SetAccessPolicy(ctx context.Context, options *SetAccessPolicyOptions) (ContainerSetAccessPolicyResponse, error)
SetAccessPolicy sets the container's permissions. The access policy indicates whether blobs in a container may be accessed publicly.
For more information, see https://docs.microsoft.com/rest/api/storageservices/set-container-acl.
This example shows how to manipulate a container's permissions.
Code:
Example¶
{
// Obtain your storage account's name and key from the Azure portal
accountName, accountKey := accountInfo()
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
log.Fatal(err)
}
uri := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer", accountName)
container, err := NewContainerClient(uri, credential, nil)
if err != nil {
log.Fatal(err)
}
// Grab the background context, use no expiry
ctx := context.Background()
// Create the container (with no metadata and no public access)
_, err = container.Create(ctx, nil)
if err != nil {
log.Fatal(err)
}
// Upload a simple blob.
blob := container.NewBlockBlobClient("HelloWorld.txt")
_, err = blob.Upload(ctx, NopCloser(strings.NewReader("Hello World!")), nil)
if err != nil {
log.Fatal(err)
}
// Attempt to read the blob
get, err := http.Get(blob.URL())
if err != nil {
log.Fatal(err)
}
if get.StatusCode == http.StatusNotFound {
_, err := container.SetAccessPolicy(ctx, &SetAccessPolicyOptions{ContainerSetAccessPolicyOptions: ContainerSetAccessPolicyOptions{Access: PublicAccessTypeBlob.ToPtr()}})
if err != nil {
log.Fatal(err)
}
// Now, this works:
get, err = http.Get(blob.URL())
if err != nil {
log.Fatal(err)
}
defer func(Body io.ReadCloser) {
err := Body.Close()
if err != nil {
}
}(get.Body)
var text bytes.Buffer
_, err = text.ReadFrom(get.Body)
if err != nil {
return
}
fmt.Println(text.String())
}
}
func (ContainerClient) SetMetadata ¶
func (c ContainerClient) SetMetadata(ctx context.Context, options *SetMetadataContainerOptions) (ContainerSetMetadataResponse, error)
SetMetadata sets the container's metadata.
For more information, see https://docs.microsoft.com/rest/api/storageservices/set-container-metadata.
This examples shows how to create a container with metadata and then how to read & update the metadata.
Code:
Example¶
{
// From the Azure portal, get your Storage account blob service URL endpoint.
accountName, accountKey := accountInfo()
// Create a containerClient object that wraps a soon-to-be-created container's URL and a default pipeline.
u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer", accountName)
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
log.Fatal(err)
}
containerClient, err := NewContainerClient(u, credential, nil)
if err != nil {
log.Fatal(err)
}
ctx := context.Background() // This example uses a never-expiring context
// Create a container with some metadata (string key/value pairs)
// NOTE: Metadata key names are always converted to lowercase before being sent to the Storage Service.
// Therefore, you should always use lowercase letters; especially when querying a map for a metadata key.
creatingApp, _ := os.Executable()
_, err = containerClient.Create(ctx, &CreateContainerOptions{Metadata: map[string]string{"author": "Jeffrey", "app": creatingApp}})
if err != nil {
log.Fatal(err)
}
// Query the container's metadata
get, err := containerClient.GetProperties(ctx, nil)
if err != nil {
log.Fatal(err)
}
// Show the container's metadata
if get.Metadata == nil {
log.Fatal("metadata is empty!")
}
metadata := get.Metadata
for k, v := range metadata {
fmt.Print(k + "=" + v + "\n")
}
// Update the metadata and write it back to the container
metadata["author"] = "Aidan" // NOTE: The keyname is in all lowercase letters
_, err = containerClient.SetMetadata(ctx, &SetMetadataContainerOptions{Metadata: metadata})
if err != nil {
log.Fatal(err)
}
// NOTE: The SetMetadata & SetProperties methods update the container's ETag & LastModified properties
}
func (ContainerClient) URL ¶
func (c ContainerClient) URL() string
URL returns the URL endpoint used by the ContainerClient object.
type ContainerCpkScopeInfo ¶
type ContainerCpkScopeInfo struct { // Optional. Version 2019-07-07 and later. Specifies the default encryption scope to set on the container and use for all future writes. DefaultEncryptionScope *string // Optional. Version 2019-07-07 and newer. If true, prevents any request from specifying a different encryption scope than the scope set on the container. PreventEncryptionScopeOverride *bool }
ContainerCpkScopeInfo contains a group of parameters for the Container.Create method.
type ContainerCreateOptions ¶
type ContainerCreateOptions struct { // Specifies whether data in the container may be accessed publicly and the level of access Access *PublicAccessType // Optional. Specifies 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. Note that beginning with version 2009-09-19, metadata names must adhere to the naming // rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. Metadata map[string]string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerCreateOptions contains the optional parameters for the Container.Create method.
type ContainerCreateResponse ¶
type ContainerCreateResponse struct { ContainerCreateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerCreateResponse contains the response from method Container.Create.
type ContainerCreateResult ¶
type ContainerCreateResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
ContainerCreateResult contains the result from method Container.Create.
type ContainerDeleteOptions ¶
type ContainerDeleteOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerDeleteOptions contains the optional parameters for the Container.Delete method.
type ContainerDeleteResponse ¶
type ContainerDeleteResponse struct { ContainerDeleteResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerDeleteResponse contains the response from method Container.Delete.
type ContainerDeleteResult ¶
type ContainerDeleteResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
ContainerDeleteResult contains the result from method Container.Delete.
type ContainerGetAccessPolicyOptions ¶
type ContainerGetAccessPolicyOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerGetAccessPolicyOptions contains the optional parameters for the Container.GetAccessPolicy method.
type ContainerGetAccessPolicyResponse ¶
type ContainerGetAccessPolicyResponse struct { ContainerGetAccessPolicyResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerGetAccessPolicyResponse contains the response from method Container.GetAccessPolicy.
type ContainerGetAccessPolicyResult ¶
type ContainerGetAccessPolicyResult struct { // BlobPublicAccess contains the information returned from the x-ms-blob-public-access header response. BlobPublicAccess *PublicAccessType `xml:"BlobPublicAccess"` // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string `xml:"ClientRequestID"` // Date contains the information returned from the Date header response. Date *time.Time `xml:"Date"` // ETag contains the information returned from the ETag header response. ETag *string `xml:"ETag"` // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time `xml:"LastModified"` // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string `xml:"RequestID"` // a collection of signed identifiers SignedIdentifiers []*SignedIdentifier `xml:"SignedIdentifier"` // Version contains the information returned from the x-ms-version header response. Version *string `xml:"Version"` }
ContainerGetAccessPolicyResult contains the result from method Container.GetAccessPolicy.
type ContainerGetAccountInfoOptions ¶
type ContainerGetAccountInfoOptions struct { }
ContainerGetAccountInfoOptions contains the optional parameters for the Container.GetAccountInfo method.
type ContainerGetAccountInfoResponse ¶
type ContainerGetAccountInfoResponse struct { ContainerGetAccountInfoResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerGetAccountInfoResponse contains the response from method Container.GetAccountInfo.
type ContainerGetAccountInfoResult ¶
type ContainerGetAccountInfoResult struct { // AccountKind contains the information returned from the x-ms-account-kind header response. AccountKind *AccountKind // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // SKUName contains the information returned from the x-ms-sku-name header response. SKUName *SKUName // Version contains the information returned from the x-ms-version header response. Version *string }
ContainerGetAccountInfoResult contains the result from method Container.GetAccountInfo.
type ContainerGetPropertiesOptions ¶
type ContainerGetPropertiesOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerGetPropertiesOptions contains the optional parameters for the Container.GetProperties method.
type ContainerGetPropertiesResponse ¶
type ContainerGetPropertiesResponse struct { ContainerGetPropertiesResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerGetPropertiesResponse contains the response from method Container.GetProperties.
type ContainerGetPropertiesResult ¶
type ContainerGetPropertiesResult struct { // BlobPublicAccess contains the information returned from the x-ms-blob-public-access header response. BlobPublicAccess *PublicAccessType // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // DefaultEncryptionScope contains the information returned from the x-ms-default-encryption-scope header response. DefaultEncryptionScope *string // DenyEncryptionScopeOverride contains the information returned from the x-ms-deny-encryption-scope-override header response. DenyEncryptionScopeOverride *bool // ETag contains the information returned from the ETag header response. ETag *string // HasImmutabilityPolicy contains the information returned from the x-ms-has-immutability-policy header response. HasImmutabilityPolicy *bool // HasLegalHold contains the information returned from the x-ms-has-legal-hold header response. HasLegalHold *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // LeaseDuration contains the information returned from the x-ms-lease-duration header response. LeaseDuration *LeaseDurationType // LeaseState contains the information returned from the x-ms-lease-state header response. LeaseState *LeaseStateType // LeaseStatus contains the information returned from the x-ms-lease-status header response. LeaseStatus *LeaseStatusType // Metadata contains the information returned from the x-ms-meta header response. Metadata map[string]string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
ContainerGetPropertiesResult contains the result from method Container.GetProperties.
type ContainerItem ¶
type ContainerItem struct { // REQUIRED Name *string `xml:"Name"` // REQUIRED; Properties of a container Properties *ContainerProperties `xml:"Properties"` Deleted *bool `xml:"Deleted"` // Dictionary of Metadata map[string]*string `xml:"Metadata"` Version *string `xml:"Version"` }
ContainerItem - An Azure Storage container
func (*ContainerItem) UnmarshalXML ¶
func (c *ContainerItem) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaller interface for type ContainerItem.
type ContainerLeaseClient ¶
type ContainerLeaseClient struct { ContainerClient // contains filtered or unexported fields }
Example¶
This example shows how to perform various lease operations on a container. The same lease operations can be performed on individual blobs as well. A lease on a container prevents it from being deleted by others, while a lease on a blob protects it from both modifications and deletions.
Code:
{ // From the Azure portal, get your Storage account's name and account key. accountName, accountKey := accountInfo() // Use your Storage account's name and key to create a credential object; this is used to access your account. credential, err := NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } // Create an containerClient object that wraps the container's URL and a default pipeline. u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer", accountName) containerClient, err := NewContainerClient(u, credential, nil) if err != nil { log.Fatal(err) } generatedUuid, err := uuid.New() if err != nil { log.Fatal(err) } leaseID := to.StringPtr(generatedUuid.String()) containerLeaseClient, err := containerClient.NewContainerLeaseClient(leaseID) if err != nil { log.Fatal(err) } // All operations allow you to specify a timeout via a Go context.Context object. ctx := context.Background() // This example uses a never-expiring context // Now acquire a lease on the container. // You can choose to pass an empty string for proposed ID so that the service automatically assigns one for you. duration := int32(60) acquireLeaseResponse, err := containerLeaseClient.AcquireLease(ctx, &AcquireLeaseContainerOptions{Duration: &duration}) if err != nil { log.Fatal(err) } fmt.Println("The container is leased for delete operations with lease ID", *acquireLeaseResponse.LeaseID) // The container cannot be deleted without providing the lease ID. _, err = containerLeaseClient.Delete(ctx, nil) if err == nil { log.Fatal("delete should have failed") } fmt.Println("The container cannot be deleted while there is an active lease") // We can release the lease now and the container can be deleted. _, err = containerLeaseClient.ReleaseLease(ctx, nil) if err != nil { log.Fatal(err) } fmt.Println("The lease on the container is now released") // Acquire a lease again to perform other operations. // Duration is still 60 acquireLeaseResponse, err = containerLeaseClient.AcquireLease(ctx, &AcquireLeaseContainerOptions{Duration: &duration}) if err != nil { log.Fatal(err) } fmt.Println("The container is leased again with lease ID", *acquireLeaseResponse.LeaseID) // We can change the ID of an existing lease. // A lease ID can be any valid GUID string format. newLeaseID, err := uuid.New() if err != nil { log.Fatal(err) } newLeaseID[0] = 1 changeLeaseResponse, err := containerLeaseClient.ChangeLease(ctx, &ChangeLeaseContainerOptions{ProposedLeaseID: to.StringPtr(newLeaseID.String())}) if err != nil { log.Fatal(err) } fmt.Println("The lease ID was changed to", *changeLeaseResponse.LeaseID) // The lease can be renewed. renewLeaseResponse, err := containerLeaseClient.RenewLease(ctx, nil) if err != nil { log.Fatal(err) } fmt.Println("The lease was renewed with the same ID", *renewLeaseResponse.LeaseID) // Finally, the lease can be broken and we could prevent others from acquiring a lease for a period of time duration = 60 _, err = containerLeaseClient.BreakLease(ctx, &BreakLeaseContainerOptions{BreakPeriod: &duration}) if err != nil { log.Fatal(err) } fmt.Println("The lease was broken, and nobody can acquire a lease for 60 seconds") }
func (*ContainerLeaseClient) AcquireLease ¶
func (clc *ContainerLeaseClient) AcquireLease(ctx context.Context, options *AcquireLeaseContainerOptions) (ContainerAcquireLeaseResponse, error)
AcquireLease acquires a lease on the container for delete operations. The lease Duration must be between 15 to 60 seconds, or infinite (-1). For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-container.
func (*ContainerLeaseClient) BreakLease ¶
func (clc *ContainerLeaseClient) BreakLease(ctx context.Context, options *BreakLeaseContainerOptions) (ContainerBreakLeaseResponse, error)
BreakLease breaks the container's previously-acquired lease (if it exists). For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-container.
func (*ContainerLeaseClient) ChangeLease ¶
func (clc *ContainerLeaseClient) ChangeLease(ctx context.Context, options *ChangeLeaseContainerOptions) (ContainerChangeLeaseResponse, error)
ChangeLease changes the container's lease ID. For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-container.
func (*ContainerLeaseClient) ReleaseLease ¶
func (clc *ContainerLeaseClient) ReleaseLease(ctx context.Context, options *ReleaseLeaseContainerOptions) (ContainerReleaseLeaseResponse, error)
ReleaseLease releases the container's previously-acquired lease. For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-container.
func (*ContainerLeaseClient) RenewLease ¶
func (clc *ContainerLeaseClient) RenewLease(ctx context.Context, options *RenewLeaseContainerOptions) (ContainerRenewLeaseResponse, error)
RenewLease renews the container's previously-acquired lease. For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-container.
type ContainerListBlobFlatSegmentOptions ¶
type ContainerListBlobFlatSegmentOptions struct { // Include this parameter to specify one or more datasets to include in the response. Include []ListBlobsIncludeItem // A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker // value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value // can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client. Marker *string // Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server // will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for // retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or // than the default of 5000. Maxresults *int32 // Filters the results to return only containers whose name begins with the specified prefix. Prefix *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerListBlobFlatSegmentOptions contains the optional parameters for the Container.ListBlobFlatSegment method.
type ContainerListBlobFlatSegmentPager ¶
type ContainerListBlobFlatSegmentPager struct {
// contains filtered or unexported fields
}
ContainerListBlobFlatSegmentPager provides operations for iterating over paged responses.
func (*ContainerListBlobFlatSegmentPager) Err ¶
func (p *ContainerListBlobFlatSegmentPager) Err() error
Err returns the last error encountered while paging.
func (*ContainerListBlobFlatSegmentPager) NextPage ¶
func (p *ContainerListBlobFlatSegmentPager) NextPage(ctx context.Context) bool
NextPage returns true if the pager advanced to the next page. Returns false if there are no more pages or an error occurred.
func (*ContainerListBlobFlatSegmentPager) PageResponse ¶
func (p *ContainerListBlobFlatSegmentPager) PageResponse() ContainerListBlobFlatSegmentResponse
PageResponse returns the current ContainerListBlobFlatSegmentResponse page.
type ContainerListBlobFlatSegmentResponse ¶
type ContainerListBlobFlatSegmentResponse struct { ContainerListBlobFlatSegmentResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerListBlobFlatSegmentResponse contains the response from method Container.ListBlobFlatSegment.
type ContainerListBlobFlatSegmentResult ¶
type ContainerListBlobFlatSegmentResult struct { ListBlobsFlatSegmentResponse // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string `xml:"ClientRequestID"` // ContentType contains the information returned from the Content-Type header response. ContentType *string `xml:"ContentType"` // Date contains the information returned from the Date header response. Date *time.Time `xml:"Date"` // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string `xml:"RequestID"` // Version contains the information returned from the x-ms-version header response. Version *string `xml:"Version"` }
ContainerListBlobFlatSegmentResult contains the result from method Container.ListBlobFlatSegment.
type ContainerListBlobHierarchySegmentOptions ¶
type ContainerListBlobHierarchySegmentOptions struct { // Include this parameter to specify one or more datasets to include in the response. Include []ListBlobsIncludeItem // A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker // value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value // can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client. Marker *string // Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server // will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for // retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or // than the default of 5000. Maxresults *int32 // Filters the results to return only containers whose name begins with the specified prefix. Prefix *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerListBlobHierarchySegmentOptions contains the optional parameters for the Container.ListBlobHierarchySegment method.
type ContainerListBlobHierarchySegmentPager ¶
type ContainerListBlobHierarchySegmentPager struct {
// contains filtered or unexported fields
}
ContainerListBlobHierarchySegmentPager provides operations for iterating over paged responses.
func (*ContainerListBlobHierarchySegmentPager) Err ¶
func (p *ContainerListBlobHierarchySegmentPager) Err() error
Err returns the last error encountered while paging.
func (*ContainerListBlobHierarchySegmentPager) NextPage ¶
func (p *ContainerListBlobHierarchySegmentPager) NextPage(ctx context.Context) bool
NextPage returns true if the pager advanced to the next page. Returns false if there are no more pages or an error occurred.
func (*ContainerListBlobHierarchySegmentPager) PageResponse ¶
func (p *ContainerListBlobHierarchySegmentPager) PageResponse() ContainerListBlobHierarchySegmentResponse
PageResponse returns the current ContainerListBlobHierarchySegmentResponse page.
type ContainerListBlobHierarchySegmentResponse ¶
type ContainerListBlobHierarchySegmentResponse struct { ContainerListBlobHierarchySegmentResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerListBlobHierarchySegmentResponse contains the response from method Container.ListBlobHierarchySegment.
type ContainerListBlobHierarchySegmentResult ¶
type ContainerListBlobHierarchySegmentResult struct { ListBlobsHierarchySegmentResponse // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string `xml:"ClientRequestID"` // ContentType contains the information returned from the Content-Type header response. ContentType *string `xml:"ContentType"` // Date contains the information returned from the Date header response. Date *time.Time `xml:"Date"` // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string `xml:"RequestID"` // Version contains the information returned from the x-ms-version header response. Version *string `xml:"Version"` }
ContainerListBlobHierarchySegmentResult contains the result from method Container.ListBlobHierarchySegment.
type ContainerProperties ¶
type ContainerProperties struct { // REQUIRED Etag *string `xml:"Etag"` // REQUIRED LastModified *time.Time `xml:"Last-Modified"` DefaultEncryptionScope *string `xml:"DefaultEncryptionScope"` DeletedTime *time.Time `xml:"DeletedTime"` HasImmutabilityPolicy *bool `xml:"HasImmutabilityPolicy"` HasLegalHold *bool `xml:"HasLegalHold"` LeaseDuration *LeaseDurationType `xml:"LeaseDuration"` LeaseState *LeaseStateType `xml:"LeaseState"` LeaseStatus *LeaseStatusType `xml:"LeaseStatus"` PreventEncryptionScopeOverride *bool `xml:"DenyEncryptionScopeOverride"` PublicAccess *PublicAccessType `xml:"PublicAccess"` RemainingRetentionDays *int32 `xml:"RemainingRetentionDays"` }
ContainerProperties - Properties of a container
func (ContainerProperties) MarshalXML ¶
func (c ContainerProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaller interface for type ContainerProperties.
func (*ContainerProperties) UnmarshalXML ¶
func (c *ContainerProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaller interface for type ContainerProperties.
type ContainerReleaseLeaseOptions ¶
type ContainerReleaseLeaseOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerReleaseLeaseOptions contains the optional parameters for the Container.ReleaseLease method.
type ContainerReleaseLeaseResponse ¶
type ContainerReleaseLeaseResponse struct { ContainerReleaseLeaseResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerReleaseLeaseResponse contains the response from method Container.ReleaseLease.
type ContainerReleaseLeaseResult ¶
type ContainerReleaseLeaseResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
ContainerReleaseLeaseResult contains the result from method Container.ReleaseLease.
type ContainerRenewLeaseOptions ¶
type ContainerRenewLeaseOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerRenewLeaseOptions contains the optional parameters for the Container.RenewLease method.
type ContainerRenewLeaseResponse ¶
type ContainerRenewLeaseResponse struct { ContainerRenewLeaseResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerRenewLeaseResponse contains the response from method Container.RenewLease.
type ContainerRenewLeaseResult ¶
type ContainerRenewLeaseResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // LeaseID contains the information returned from the x-ms-lease-id header response. LeaseID *string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
ContainerRenewLeaseResult contains the result from method Container.RenewLease.
type ContainerRestoreOptions ¶
type ContainerRestoreOptions struct { // Optional. Version 2019-12-12 and later. Specifies the name of the deleted container to restore. DeletedContainerName *string // Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore. DeletedContainerVersion *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerRestoreOptions contains the optional parameters for the Container.Restore method.
type ContainerRestoreResponse ¶
type ContainerRestoreResponse struct { ContainerRestoreResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerRestoreResponse contains the response from method Container.Restore.
type ContainerRestoreResult ¶
type ContainerRestoreResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
ContainerRestoreResult contains the result from method Container.Restore.
type ContainerSASPermissions ¶
type ContainerSASPermissions struct { Read, Add, Create, Write, Delete, List bool }
The ContainerSASPermissions type simplifies creating the permissions string for an Azure Storage container SAS. Initialize an instance of this type and then call its String method to set BlobSASSignatureValues's Permissions field.
func (*ContainerSASPermissions) Parse ¶
func (p *ContainerSASPermissions) Parse(s string) error
Parse initializes the ContainerSASPermissions's fields from a string.
func (ContainerSASPermissions) String ¶
func (p ContainerSASPermissions) String() string
String produces the SAS permissions string for an Azure Storage container. Call this method to set BlobSASSignatureValues's Permissions field.
type ContainerSetAccessPolicyOptions ¶
type ContainerSetAccessPolicyOptions struct { // Specifies whether data in the container may be accessed publicly and the level of access Access *PublicAccessType // the acls for the container ContainerACL []*SignedIdentifier // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerSetAccessPolicyOptions contains the optional parameters for the Container.SetAccessPolicy method.
type ContainerSetAccessPolicyResponse ¶
type ContainerSetAccessPolicyResponse struct { ContainerSetAccessPolicyResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerSetAccessPolicyResponse contains the response from method Container.SetAccessPolicy.
type ContainerSetAccessPolicyResult ¶
type ContainerSetAccessPolicyResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
ContainerSetAccessPolicyResult contains the result from method Container.SetAccessPolicy.
type ContainerSetMetadataOptions ¶
type ContainerSetMetadataOptions struct { // Optional. Specifies 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. Note that beginning with version 2009-09-19, metadata names must adhere to the naming // rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. Metadata map[string]string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ContainerSetMetadataOptions contains the optional parameters for the Container.SetMetadata method.
type ContainerSetMetadataResponse ¶
type ContainerSetMetadataResponse struct { ContainerSetMetadataResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ContainerSetMetadataResponse contains the response from method Container.SetMetadata.
type ContainerSetMetadataResult ¶
type ContainerSetMetadataResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
ContainerSetMetadataResult contains the result from method Container.SetMetadata.
type CopyBlockBlobFromURLOptions ¶
type CopyBlockBlobFromURLOptions struct { BlobTagsMap map[string]string Metadata map[string]string RequestID *string SourceContentMD5 []byte Tier *AccessTier Timeout *int32 SourceModifiedAccessConditions *SourceModifiedAccessConditions BlobAccessConditions *BlobAccessConditions }
type CopyIncrementalPageBlobOptions ¶
type CopyIncrementalPageBlobOptions struct { ModifiedAccessConditions *ModifiedAccessConditions RequestID *string Timeout *int32 }
type CopyStatusType ¶
type CopyStatusType string
const ( CopyStatusTypePending CopyStatusType = "pending" CopyStatusTypeSuccess CopyStatusType = "success" CopyStatusTypeAborted CopyStatusType = "aborted" CopyStatusTypeFailed CopyStatusType = "failed" )
func PossibleCopyStatusTypeValues ¶
func PossibleCopyStatusTypeValues() []CopyStatusType
PossibleCopyStatusTypeValues returns the possible values for the CopyStatusType const type.
func (CopyStatusType) ToPtr ¶
func (c CopyStatusType) ToPtr() *CopyStatusType
ToPtr returns a *CopyStatusType pointing to the current value.
type CorsRule ¶
type CorsRule struct { // REQUIRED; the request headers that the origin domain may specify on the CORS request. AllowedHeaders *string `xml:"AllowedHeaders"` // REQUIRED; The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated) AllowedMethods *string `xml:"AllowedMethods"` // REQUIRED; The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the // request originates. Note that the origin must be an exact // case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains // to make requests via CORS. AllowedOrigins *string `xml:"AllowedOrigins"` // REQUIRED; The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer ExposedHeaders *string `xml:"ExposedHeaders"` // REQUIRED; The maximum amount time that a browser should cache the preflight OPTIONS request. MaxAgeInSeconds *int32 `xml:"MaxAgeInSeconds"` }
CorsRule - CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain
type CpkInfo ¶
type CpkInfo struct { // The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header // is provided. EncryptionAlgorithm *string // Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account // encryption key. For more information, see Encryption at Rest for Azure Storage Services. EncryptionKey *string // The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. EncryptionKeySHA256 *string }
CpkInfo contains a group of parameters for the Blob.Download method.
type CpkScopeInfo ¶
type CpkScopeInfo struct { // Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, // encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services. EncryptionScope *string }
CpkScopeInfo contains a group of parameters for the Blob.SetMetadata method.
type CreateAppendBlobOptions ¶
type CreateAppendBlobOptions struct { BlobAccessConditions *BlobAccessConditions HTTPHeaders *BlobHTTPHeaders CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo // Optional. Used to set blob tags in various blob operations. TagsMap map[string]string // Optional. Specifies 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. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. // See Naming and Referencing Containers, Blobs, and Metadata for more information. Metadata map[string]string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string Timeout *int32 }
type CreateBlobSnapshotOptions ¶
type CreateBlobSnapshotOptions struct { Metadata map[string]string LeaseAccessConditions *LeaseAccessConditions CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo ModifiedAccessConditions *ModifiedAccessConditions }
type CreateContainerOptions ¶
type CreateContainerOptions struct { // Specifies whether data in the container may be accessed publicly and the level of access Access *PublicAccessType // Optional. Specifies a user-defined name-value pair associated with the blob. Metadata map[string]string // contains filtered or unexported fields }
type CreatePageBlobOptions ¶
type CreatePageBlobOptions struct { // Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of // the sequence number must be between 0 and 2^63 - 1. BlobSequenceNumber *int64 // Optional. Used to set blob tags in various blob operations. TagsMap map[string]string // Optional. Specifies 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. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. // See Naming and Referencing Containers, Blobs, and Metadata for more information. Metadata map[string]string // Optional. Indicates the tier to be set on the page blob. Tier *PremiumPageBlobAccessTier HTTPHeaders *BlobHTTPHeaders CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo BlobAccessConditions *BlobAccessConditions }
type DataLakeStorageError ¶
type DataLakeStorageError struct { // The service error response object. DataLakeStorageErrorDetails *DataLakeStorageErrorAutoGenerated `xml:"error"` // contains filtered or unexported fields }
Implements the error and azcore.HTTPResponse interfaces.
func (DataLakeStorageError) Error ¶
func (e DataLakeStorageError) Error() string
Error implements the error interface for type DataLakeStorageError. The contents of the error text are not contractual and subject to change.
type DataLakeStorageErrorAutoGenerated ¶
type DataLakeStorageErrorAutoGenerated struct { // The service error code. Code *string `xml:"Code"` // The service error message. Message *string `xml:"Message"` }
DataLakeStorageErrorAutoGenerated - The service error response object.
type DeleteBlobOptions ¶
type DeleteBlobOptions struct { // Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob // and all of its snapshots. only: Delete only the blob's snapshots and not the blob itself DeleteSnapshots *DeleteSnapshotsOptionType BlobAccessConditions *BlobAccessConditions }
type DeleteContainerOptions ¶
type DeleteContainerOptions struct { LeaseAccessConditions *LeaseAccessConditions ModifiedAccessConditions *ModifiedAccessConditions }
type DeleteSnapshotsOptionType ¶
type DeleteSnapshotsOptionType string
const ( DeleteSnapshotsOptionTypeInclude DeleteSnapshotsOptionType = "include" DeleteSnapshotsOptionTypeOnly DeleteSnapshotsOptionType = "only" )
func PossibleDeleteSnapshotsOptionTypeValues ¶
func PossibleDeleteSnapshotsOptionTypeValues() []DeleteSnapshotsOptionType
PossibleDeleteSnapshotsOptionTypeValues returns the possible values for the DeleteSnapshotsOptionType const type.
func (DeleteSnapshotsOptionType) ToPtr ¶
func (c DeleteSnapshotsOptionType) ToPtr() *DeleteSnapshotsOptionType
ToPtr returns a *DeleteSnapshotsOptionType pointing to the current value.
type DelimitedTextConfiguration ¶
type DelimitedTextConfiguration struct { // The string used to separate columns. ColumnSeparator *string `xml:"ColumnSeparator"` // The string used as an escape character. EscapeChar *string `xml:"EscapeChar"` // The string used to quote a specific field. FieldQuote *string `xml:"FieldQuote"` // Represents whether the data has headers. HeadersPresent *bool `xml:"HasHeaders"` // The string used to separate records. RecordSeparator *string `xml:"RecordSeparator"` }
DelimitedTextConfiguration - Groups the settings used for interpreting the blob data if the blob is delimited text formatted.
type DirectoryCreateOptions ¶
type DirectoryCreateOptions struct { // Optional. User-defined properties to be stored with the file or directory, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, // ...", where each value is base64 encoded. DirectoryProperties *string // Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, // and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal // notation (e.g. 0766) are supported. PosixPermissions *string // Only valid if Hierarchical Namespace is enabled for the account. This umask restricts permission settings for file and directory, and will only be applied // when default Acl does not exist in parent directory. If the umask bit has set, it means that the corresponding permission will be disabled. Otherwise // the corresponding permission will be determined by the permission. A 4-digit octal notation (e.g. 0022) is supported here. If no umask was specified, // a default umask - 0027 will be used. PosixUmask *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
DirectoryCreateOptions contains the optional parameters for the Directory.Create method.
type DirectoryCreateResponse ¶
type DirectoryCreateResponse struct { DirectoryCreateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
DirectoryCreateResponse contains the response from method Directory.Create.
type DirectoryCreateResult ¶
type DirectoryCreateResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentLength contains the information returned from the Content-Length header response. ContentLength *int64 // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
DirectoryCreateResult contains the result from method Directory.Create.
type DirectoryDeleteOptions ¶
type DirectoryDeleteOptions struct { // When renaming a directory, the number of paths that are renamed with each invocation is limited. If the number of paths to be renamed exceeds this limit, // a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent // invocation of the rename operation to continue renaming the directory. Marker *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
DirectoryDeleteOptions contains the optional parameters for the Directory.Delete method.
type DirectoryDeleteResponse ¶
type DirectoryDeleteResponse struct { DirectoryDeleteResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
DirectoryDeleteResponse contains the response from method Directory.Delete.
type DirectoryDeleteResult ¶
type DirectoryDeleteResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // Marker contains the information returned from the x-ms-continuation header response. Marker *string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
DirectoryDeleteResult contains the result from method Directory.Delete.
type DirectoryGetAccessControlOptions ¶
type DirectoryGetAccessControlOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the identity values returned in the x-ms-owner, x-ms-group, and // x-ms-acl response headers will be transformed from Azure Active Directory Object IDs to User Principal Names. If "false", the values will be returned // as Azure Active Directory Object IDs. The default value is false. Upn *bool }
DirectoryGetAccessControlOptions contains the optional parameters for the Directory.GetAccessControl method.
type DirectoryGetAccessControlResponse ¶
type DirectoryGetAccessControlResponse struct { DirectoryGetAccessControlResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
DirectoryGetAccessControlResponse contains the response from method Directory.GetAccessControl.
type DirectoryGetAccessControlResult ¶
type DirectoryGetAccessControlResult struct { // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // XMSACL contains the information returned from the x-ms-acl header response. XMSACL *string // XMSGroup contains the information returned from the x-ms-group header response. XMSGroup *string // XMSOwner contains the information returned from the x-ms-owner header response. XMSOwner *string // XMSPermissions contains the information returned from the x-ms-permissions header response. XMSPermissions *string }
DirectoryGetAccessControlResult contains the result from method Directory.GetAccessControl.
type DirectoryHTTPHeaders ¶
type DirectoryHTTPHeaders struct { // Cache control for given resource CacheControl *string // Content disposition for given resource ContentDisposition *string // Content encoding for given resource ContentEncoding *string // Content language for given resource ContentLanguage *string // Content type for given resource ContentType *string }
DirectoryHTTPHeaders contains a group of parameters for the Directory.Create method.
type DirectoryRenameOptions ¶
type DirectoryRenameOptions struct { // Optional. User-defined properties to be stored with the file or directory, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, // ...", where each value is base64 encoded. DirectoryProperties *string // When renaming a directory, the number of paths that are renamed with each invocation is limited. If the number of paths to be renamed exceeds this limit, // a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent // invocation of the rename operation to continue renaming the directory. Marker *string // Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, // and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal // notation (e.g. 0766) are supported. PosixPermissions *string // Only valid if Hierarchical Namespace is enabled for the account. This umask restricts permission settings for file and directory, and will only be applied // when default Acl does not exist in parent directory. If the umask bit has set, it means that the corresponding permission will be disabled. Otherwise // the corresponding permission will be determined by the permission. A 4-digit octal notation (e.g. 0022) is supported here. If no umask was specified, // a default umask - 0027 will be used. PosixUmask *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. SourceLeaseID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
DirectoryRenameOptions contains the optional parameters for the Directory.Rename method.
type DirectoryRenameResponse ¶
type DirectoryRenameResponse struct { DirectoryRenameResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
DirectoryRenameResponse contains the response from method Directory.Rename.
type DirectoryRenameResult ¶
type DirectoryRenameResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentLength contains the information returned from the Content-Length header response. ContentLength *int64 // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // Marker contains the information returned from the x-ms-continuation header response. Marker *string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
DirectoryRenameResult contains the result from method Directory.Rename.
type DirectorySetAccessControlOptions ¶
type DirectorySetAccessControlOptions struct { // Optional. The owning group of the blob or directory. Group *string // Optional. The owner of the blob or directory. Owner *string // Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. Each access control entry (ACE) // consists of a scope, a type, a user or group identifier, and permissions in the format "[scope:][type]:[id]:[permissions]". PosixACL *string // Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, // and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal // notation (e.g. 0766) are supported. PosixPermissions *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
DirectorySetAccessControlOptions contains the optional parameters for the Directory.SetAccessControl method.
type DirectorySetAccessControlResponse ¶
type DirectorySetAccessControlResponse struct { DirectorySetAccessControlResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
DirectorySetAccessControlResponse contains the response from method Directory.SetAccessControl.
type DirectorySetAccessControlResult ¶
type DirectorySetAccessControlResult struct { // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
DirectorySetAccessControlResult contains the result from method Directory.SetAccessControl.
type DownloadBlobOptions ¶
type DownloadBlobOptions struct { // When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the // range is less than or equal to 4 MB in size. RangeGetContentMD5 *bool // Optional, you can specify whether a particular range of the blob is read Offset *int64 Count *int64 BlobAccessConditions *BlobAccessConditions CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo }
type DownloadResponse ¶
type DownloadResponse struct { BlobDownloadResponse ObjectReplicationRules []ObjectReplicationPolicy // contains filtered or unexported fields }
DownloadResponse wraps AutoRest generated DownloadResponse and helps to provide info for retry.
func (*DownloadResponse) Body ¶
func (r *DownloadResponse) Body(o RetryReaderOptions) io.ReadCloser
Body constructs new RetryReader stream for reading data. If a connection fails while reading, it will make additional requests to reestablish a connection and continue reading. Specifying a RetryReaderOption's with MaxRetryRequests set to 0 (the default), returns the original response body and no retries will be performed.
type FailedReadNotifier ¶
type FailedReadNotifier func(failureCount int, lastError error, offset int64, count int64, willRetry bool)
FailedReadNotifier is a function type that represents the notification function called when a read fails
type FilterBlobItem ¶
type FilterBlobItem struct { // REQUIRED ContainerName *string `xml:"ContainerName"` // REQUIRED Name *string `xml:"Name"` // REQUIRED TagValue *string `xml:"TagValue"` }
FilterBlobItem - Blob info from a Filter Blobs API call
type FilterBlobSegment ¶
type FilterBlobSegment struct { // REQUIRED Blobs []*FilterBlobItem `xml:"Blobs>Blob"` // REQUIRED ServiceEndpoint *string `xml:"ServiceEndpoint,attr"` // REQUIRED Where *string `xml:"Where"` NextMarker *string `xml:"NextMarker"` }
FilterBlobSegment - The result of a Filter Blobs API call
func (FilterBlobSegment) MarshalXML ¶
func (f FilterBlobSegment) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaller interface for type FilterBlobSegment.
type GeoReplication ¶
type GeoReplication struct { // REQUIRED; A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. // Primary writes after this point in time may or may // not be available for reads. LastSyncTime *time.Time `xml:"LastSyncTime"` // REQUIRED; The status of the secondary location Status *GeoReplicationStatusType `xml:"Status"` }
GeoReplication - Geo-Replication information for the Secondary Storage Service
func (GeoReplication) MarshalXML ¶
func (g GeoReplication) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaller interface for type GeoReplication.
func (*GeoReplication) UnmarshalXML ¶
func (g *GeoReplication) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaller interface for type GeoReplication.
type GeoReplicationStatusType ¶
type GeoReplicationStatusType string
GeoReplicationStatusType - The status of the secondary location
const ( GeoReplicationStatusTypeBootstrap GeoReplicationStatusType = "bootstrap" GeoReplicationStatusTypeLive GeoReplicationStatusType = "live" GeoReplicationStatusType = "unavailable" )
func PossibleGeoReplicationStatusTypeValues ¶
func PossibleGeoReplicationStatusTypeValues() []GeoReplicationStatusType
PossibleGeoReplicationStatusTypeValues returns the possible values for the GeoReplicationStatusType const type.
func (GeoReplicationStatusType) ToPtr ¶
func (c GeoReplicationStatusType) ToPtr() *GeoReplicationStatusType
ToPtr returns a *GeoReplicationStatusType pointing to the current value.
type GetAccessPolicyOptions ¶
type GetAccessPolicyOptions struct { ContainerGetAccessPolicyOptions *ContainerGetAccessPolicyOptions LeaseAccessConditions *LeaseAccessConditions }
type GetBlobPropertiesOptions ¶
type GetBlobPropertiesOptions struct { BlobAccessConditions *BlobAccessConditions CpkInfo *CpkInfo }
type GetBlobPropertiesResponse ¶
type GetBlobPropertiesResponse struct { BlobGetPropertiesResponse // deserialized attributes ObjectReplicationRules []ObjectReplicationPolicy }
type GetBlockListOptions ¶
type GetBlockListOptions struct { BlockBlobGetBlockListOptions *BlockBlobGetBlockListOptions BlobAccessConditions *BlobAccessConditions }
type GetPageRangesOptions ¶
type GetPageRangesOptions struct { Snapshot *string BlobAccessConditions *BlobAccessConditions }
type GetPropertiesOptionsContainer ¶
type GetPropertiesOptionsContainer struct { ContainerGetPropertiesOptions *ContainerGetPropertiesOptions LeaseAccessConditions *LeaseAccessConditions }
type GetTagsBlobOptions ¶
type GetTagsBlobOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. Snapshot *string // The timeout parameter is expressed in seconds. Timeout *int32 // The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. // It's for service version 2019-10-10 and newer. VersionID *string ModifiedAccessConditions *ModifiedAccessConditions }
type HTTPGetter ¶
HTTPGetter is a function type that refers to a method that performs an HTTP GET operation.
type HTTPGetterInfo ¶
type HTTPGetterInfo struct { // Offset specifies the start offset that should be used when // creating the HTTP GET request's Range header Offset int64 // Count specifies the count of bytes that should be used to calculate // the end offset when creating the HTTP GET request's Range header Count int64 // ETag specifies the resource's etag that should be used when creating // the HTTP GET request's If-Match header ETag string }
HTTPGetterInfo is passed to an HTTPGetter function passing it parameters that should be used to make an HTTP GET request.
type HighLevelDownloadFromBlobOptions ¶
type HighLevelDownloadFromBlobOptions struct { // BlockSize specifies the block size to use for each parallel download; the default size is BlobDefaultDownloadBlockSize. BlockSize int64 // Progress is a function that is invoked periodically as bytes are received. Progress func(bytesTransferred int64) // BlobAccessConditions indicates the access conditions used when making HTTP GET requests against the blob. BlobAccessConditions *BlobAccessConditions // ClientProvidedKeyOptions indicates the client provided key by name and/or by value to encrypt/decrypt data. CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo // Parallelism indicates the maximum number of blocks to download in parallel (0=default) Parallelism uint16 // RetryReaderOptionsPerBlock is used when downloading each block. RetryReaderOptionsPerBlock RetryReaderOptions }
HighLevelDownloadFromBlobOptions identifies options used by the DownloadBlobToBuffer and DownloadBlobToFile functions.
type HighLevelUploadToBlockBlobOption ¶
type HighLevelUploadToBlockBlobOption struct { // BlockSize specifies the block size to use; the default (and maximum size) is BlockBlobMaxStageBlockBytes. BlockSize int64 // Progress is a function that is invoked periodically as bytes are sent to the BlockBlobClient. // Note that the progress reporting is not always increasing; it can go down when retrying a request. Progress func(bytesTransferred int64) // HTTPHeaders indicates the HTTP headers to be associated with the blob. HTTPHeaders *BlobHTTPHeaders // Metadata indicates the metadata to be associated with the blob when PutBlockList is called. Metadata map[string]string // BlobAccessConditions indicates the access conditions for the block blob. BlobAccessConditions *BlobAccessConditions // AccessTier indicates the tier of blob AccessTier *AccessTier // TagsMap TagsMap map[string]string // ClientProvidedKeyOptions indicates the client provided key by name and/or by value to encrypt/decrypt data. CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo // Parallelism indicates the maximum number of blocks to upload in parallel (0=default) Parallelism uint16 // Optional header, Specifies the transactional crc64 for the body, to be validated by the service. TransactionalContentCRC64 *[]byte // Specify the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 *[]byte }
HighLevelUploadToBlockBlobOption identifies options used by the UploadBufferToBlockBlob and UploadFileToBlockBlob functions.
type HttpRange ¶
type HttpRange struct {
// contains filtered or unexported fields
}
HttpRange defines a range of bytes within an HTTP resource, starting at offset and ending at offset+count. A zero-value HttpRange indicates the entire resource. An HttpRange which has an offset but na zero value count indicates from the offset to the resource's end.
type IPEndpointStyleInfo ¶
type IPEndpointStyleInfo struct { AccountName string // "" if not using IP endpoint style }
IPEndpointStyleInfo is used for IP endpoint style URL when working with Azure storage emulator. Ex: "https://10.132.141.33/accountname/containername"
type IPRange ¶
type IPRange struct { Start net.IP // Not specified if length = 0 End net.IP // Not specified if length = 0 }
IPRange represents a SAS IP range's start IP and (optionally) end IP.
func (*IPRange) String ¶
String returns a string representation of an IPRange.
type InternalError ¶
type InternalError struct {
// contains filtered or unexported fields
}
InternalError is an internal error type that all errors get wrapped in.
func (*InternalError) As ¶
func (e *InternalError) As(target interface{}) bool
func (*InternalError) Error ¶
func (e *InternalError) Error() string
func (*InternalError) Is ¶
func (e *InternalError) Is(err error) bool
type JSONTextConfiguration ¶
type JSONTextConfiguration struct { // The string used to separate records. RecordSeparator *string `xml:"RecordSeparator"` }
JSONTextConfiguration - json text configuration
type KeyInfo ¶
type KeyInfo struct { // REQUIRED; The date-time the key expires in ISO 8601 UTC time Expiry *string `xml:"Expiry"` // REQUIRED; The date-time the key is active in ISO 8601 UTC time Start *string `xml:"Start"` }
KeyInfo - Key information
type LeaseAccessConditions ¶
type LeaseAccessConditions struct { // If specified, the operation only succeeds if the resource's lease is active and matches this ID. LeaseID *string }
LeaseAccessConditions contains a group of parameters for the Container.GetProperties method.
type LeaseDurationType ¶
type LeaseDurationType string
const ( LeaseDurationTypeInfinite LeaseDurationType = "infinite" LeaseDurationTypeFixed LeaseDurationType = "fixed" )
func PossibleLeaseDurationTypeValues ¶
func PossibleLeaseDurationTypeValues() []LeaseDurationType
PossibleLeaseDurationTypeValues returns the possible values for the LeaseDurationType const type.
func (LeaseDurationType) ToPtr ¶
func (c LeaseDurationType) ToPtr() *LeaseDurationType
ToPtr returns a *LeaseDurationType pointing to the current value.
type LeaseStateType ¶
type LeaseStateType string
const ( LeaseStateTypeAvailable LeaseStateType = "available" LeaseStateTypeLeased LeaseStateType = "leased" LeaseStateTypeExpired LeaseStateType = "expired" LeaseStateTypeBreaking LeaseStateType = "breaking" LeaseStateTypeBroken LeaseStateType = "broken" )
func PossibleLeaseStateTypeValues ¶
func PossibleLeaseStateTypeValues() []LeaseStateType
PossibleLeaseStateTypeValues returns the possible values for the LeaseStateType const type.
func (LeaseStateType) ToPtr ¶
func (c LeaseStateType) ToPtr() *LeaseStateType
ToPtr returns a *LeaseStateType pointing to the current value.
type LeaseStatusType ¶
type LeaseStatusType string
const ( LeaseStatusTypeLocked LeaseStatusType = "locked" LeaseStatusTypeUnlocked LeaseStatusType = "unlocked" )
func PossibleLeaseStatusTypeValues ¶
func PossibleLeaseStatusTypeValues() []LeaseStatusType
PossibleLeaseStatusTypeValues returns the possible values for the LeaseStatusType const type.
func (LeaseStatusType) ToPtr ¶
func (c LeaseStatusType) ToPtr() *LeaseStatusType
ToPtr returns a *LeaseStatusType pointing to the current value.
type ListBlobsFlatSegmentResponse ¶
type ListBlobsFlatSegmentResponse struct { // REQUIRED ContainerName *string `xml:"ContainerName,attr"` // REQUIRED Segment *BlobFlatListSegment `xml:"Blobs"` // REQUIRED ServiceEndpoint *string `xml:"ServiceEndpoint,attr"` Marker *string `xml:"Marker"` MaxResults *int32 `xml:"MaxResults"` NextMarker *string `xml:"NextMarker"` Prefix *string `xml:"Prefix"` }
ListBlobsFlatSegmentResponse - An enumeration of blobs
type ListBlobsHierarchySegmentResponse ¶
type ListBlobsHierarchySegmentResponse struct { // REQUIRED ContainerName *string `xml:"ContainerName,attr"` // REQUIRED Segment *BlobHierarchyListSegment `xml:"Blobs"` // REQUIRED ServiceEndpoint *string `xml:"ServiceEndpoint,attr"` Delimiter *string `xml:"Delimiter"` Marker *string `xml:"Marker"` MaxResults *int32 `xml:"MaxResults"` NextMarker *string `xml:"NextMarker"` Prefix *string `xml:"Prefix"` }
ListBlobsHierarchySegmentResponse - An enumeration of blobs
type ListBlobsIncludeItem ¶
type ListBlobsIncludeItem string
const ( ListBlobsIncludeItemCopy ListBlobsIncludeItem = "copy" ListBlobsIncludeItemDeleted ListBlobsIncludeItem = "deleted" ListBlobsIncludeItemMetadata ListBlobsIncludeItem = "metadata" ListBlobsIncludeItemSnapshots ListBlobsIncludeItem = "snapshots" ListBlobsIncludeItemUncommittedblobs ListBlobsIncludeItem = "uncommittedblobs" ListBlobsIncludeItemVersions ListBlobsIncludeItem = "versions" ListBlobsIncludeItemTags ListBlobsIncludeItem = "tags" )
func PossibleListBlobsIncludeItemValues ¶
func PossibleListBlobsIncludeItemValues() []ListBlobsIncludeItem
PossibleListBlobsIncludeItemValues returns the possible values for the ListBlobsIncludeItem const type.
func (ListBlobsIncludeItem) ToPtr ¶
func (c ListBlobsIncludeItem) ToPtr() *ListBlobsIncludeItem
ToPtr returns a *ListBlobsIncludeItem pointing to the current value.
type ListContainersDetail ¶
type ListContainersDetail struct { // Tells the service whether to return metadata for each container. Metadata bool // Tells the service whether to return soft-deleted containers. Deleted bool }
ListContainersDetail indicates what additional information the service should return with each container.
type ListContainersIncludeType ¶
type ListContainersIncludeType string
const ( ListContainersIncludeTypeMetadata ListContainersIncludeType = "metadata" ListContainersIncludeTypeDeleted ListContainersIncludeType = "deleted" )
func PossibleListContainersIncludeTypeValues ¶
func PossibleListContainersIncludeTypeValues() []ListContainersIncludeType
PossibleListContainersIncludeTypeValues returns the possible values for the ListContainersIncludeType const type.
func (ListContainersIncludeType) ToPtr ¶
func (c ListContainersIncludeType) ToPtr() *ListContainersIncludeType
ToPtr returns a *ListContainersIncludeType pointing to the current value.
type ListContainersOptions ¶
type ListContainersOptions struct { Include ListContainersDetail // A string value that identifies the portion of the list of containers to be returned with the next listing operation. The // operation returns the NextMarker value within the response body if the listing operation did not return all containers // remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in // a subsequent call to request the next page of list items. The marker value is opaque to the client. Marker *string // Specifies the maximum number of containers to return. If the request does not specify max results, or specifies a value // greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, // then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible // that the service will return fewer results than specified by max results, or than the default of 5000. MaxResults *int32 // Filters the results to return only containers whose name begins with the specified prefix. Prefix *string }
type ListContainersSegmentResponse ¶
type ListContainersSegmentResponse struct { // REQUIRED ContainerItems []*ContainerItem `xml:"Containers>Container"` // REQUIRED ServiceEndpoint *string `xml:"ServiceEndpoint,attr"` Marker *string `xml:"Marker"` MaxResults *int32 `xml:"MaxResults"` NextMarker *string `xml:"NextMarker"` Prefix *string `xml:"Prefix"` }
ListContainersSegmentResponse - An enumeration of containers
func (ListContainersSegmentResponse) MarshalXML ¶
func (l ListContainersSegmentResponse) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaller interface for type ListContainersSegmentResponse.
type Logging ¶
type Logging struct { // REQUIRED; Indicates whether all delete requests should be logged. Delete *bool `xml:"Delete"` // REQUIRED; Indicates whether all read requests should be logged. Read *bool `xml:"Read"` // REQUIRED; the retention policy which determines how long the associated data should persist RetentionPolicy *RetentionPolicy `xml:"RetentionPolicy"` // REQUIRED; The version of Storage Analytics to configure. Version *string `xml:"Version"` // REQUIRED; Indicates whether all write requests should be logged. Write *bool `xml:"Write"` }
Logging - Azure Analytics Logging settings.
type Metrics ¶
type Metrics struct { // REQUIRED; Indicates whether metrics are enabled for the Blob service. Enabled *bool `xml:"Enabled"` // Indicates whether metrics should generate summary statistics for called API operations. IncludeAPIs *bool `xml:"IncludeAPIs"` // the retention policy which determines how long the associated data should persist RetentionPolicy *RetentionPolicy `xml:"RetentionPolicy"` // The version of Storage Analytics to configure. Version *string `xml:"Version"` }
Metrics - a summary of request statistics grouped by API in hour or minute aggregates for blobs
type ModifiedAccessConditions ¶
type ModifiedAccessConditions struct { // Specify an ETag value to operate only on blobs with a matching value. IfMatch *string // Specify this header value to operate only on a blob if it has been modified since the specified date/time. IfModifiedSince *time.Time // Specify an ETag value to operate only on blobs without a matching value. IfNoneMatch *string // Specify a SQL where clause on blob tags to operate only on blobs with a matching value. IfTags *string // Specify this header value to operate only on a blob if it has not been modified since the specified date/time. IfUnmodifiedSince *time.Time }
ModifiedAccessConditions contains a group of parameters for the Container.Delete method.
type ObjectReplicationPolicy ¶
type ObjectReplicationPolicy struct { PolicyId *string Rules *[]ObjectReplicationRules }
type ObjectReplicationRules ¶
type PageBlobClearPagesOptions ¶
type PageBlobClearPagesOptions struct { // Return only the bytes of the blob in the specified range. Range *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
PageBlobClearPagesOptions contains the optional parameters for the PageBlob.ClearPages method.
type PageBlobClearPagesResponse ¶
type PageBlobClearPagesResponse struct { PageBlobClearPagesResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
PageBlobClearPagesResponse contains the response from method PageBlob.ClearPages.
type PageBlobClearPagesResult ¶
type PageBlobClearPagesResult struct { // BlobSequenceNumber contains the information returned from the x-ms-blob-sequence-number header response. BlobSequenceNumber *int64 // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // XMSContentCRC64 contains the information returned from the x-ms-content-crc64 header response. XMSContentCRC64 []byte }
PageBlobClearPagesResult contains the result from method PageBlob.ClearPages.
type PageBlobClient ¶
type PageBlobClient struct { BlobClient // contains filtered or unexported fields }
Example¶
ExamplePageBlobClient shows how to manipulate a page blob with PageBlobClient. A page blob is a collection of 512-byte pages optimized for random read and write operations. The maximum size for a page blob is 8 TB.
Code:
{ // From the Azure portal, get your Storage account blob service URL endpoint. accountName, accountKey := accountInfo() // Create a ContainerClient object that wraps a soon-to-be-created blob's URL and a default pipeline. u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/MyPageBlob.txt", accountName) credential, err := NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } blobClient, err := NewPageBlobClient(u, credential, nil) if err != nil { log.Fatal(err) } ctx := context.Background() // This example uses a never-expiring context _, err = blobClient.Create(ctx, PageBlobPageBytes*4, nil) if err != nil { log.Fatal(err) } page := [PageBlobPageBytes]byte{} copy(page[:], "Page 0") _, err = blobClient.UploadPages(ctx, NopCloser(bytes.NewReader(page[:])), nil) if err != nil { log.Fatal(err) } copy(page[:], "Page 1") _, err = blobClient.UploadPages(ctx, NopCloser(bytes.NewReader(page[:])), &UploadPagesOptions{PageRange: &HttpRange{0, 2 * PageBlobPageBytes}}) if err != nil { log.Fatal(err) } getPages, err := blobClient.GetPageRanges(ctx, HttpRange{0 * PageBlobPageBytes, 10 * PageBlobPageBytes}, nil) if err != nil { log.Fatal(err) } for _, pr := range getPages.PageList.PageRange { fmt.Printf("Start=%d, End=%d\n", pr.Start, pr.End) } _, err = blobClient.ClearPages(ctx, HttpRange{0 * PageBlobPageBytes, 1 * PageBlobPageBytes}, nil) if err != nil { log.Fatal(err) } getPages, err = blobClient.GetPageRanges(ctx, HttpRange{0 * PageBlobPageBytes, 10 * PageBlobPageBytes}, nil) if err != nil { log.Fatal(err) } for _, pr := range getPages.PageList.PageRange { fmt.Printf("Start=%d, End=%d\n", pr.Start, pr.End) } get, err := blobClient.Download(ctx, nil) if err != nil { log.Fatal(err) } blobData := &bytes.Buffer{} reader := get.Body(RetryReaderOptions{}) _, err = blobData.ReadFrom(reader) if err != nil { return } err = reader.Close() if err != nil { return } // The client must close the response body when finished with it fmt.Printf("%#v", blobData.Bytes()) }
func NewPageBlobClient ¶
func NewPageBlobClient(blobURL string, cred azcore.Credential, options *ClientOptions) (PageBlobClient, error)
func (PageBlobClient) ClearPages ¶
func (pb PageBlobClient) ClearPages(ctx context.Context, pageRange HttpRange, options *ClearPagesOptions) (PageBlobClearPagesResponse, error)
ClearPages frees the specified pages from the page blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-page.
func (PageBlobClient) Create ¶
func (pb PageBlobClient) Create(ctx context.Context, size int64, options *CreatePageBlobOptions) (PageBlobCreateResponse, error)
Create creates a page blob of the specified length. Call PutPage to upload data to a page blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.
func (PageBlobClient) GetPageRanges ¶
func (pb PageBlobClient) GetPageRanges(ctx context.Context, pageRange HttpRange, options *GetPageRangesOptions) (PageBlobGetPageRangesResponse, error)
GetPageRanges returns the list of valid page ranges for a page blob or snapshot of a page blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges.
func (PageBlobClient) GetPageRangesDiff ¶
func (pb PageBlobClient) GetPageRangesDiff(ctx context.Context, pageRange HttpRange, prevSnapshot string, options *GetPageRangesOptions) (PageBlobGetPageRangesDiffResponse, error)
GetPageRangesDiff gets the collection of page ranges that differ between a specified snapshot and this page blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges.
func (PageBlobClient) Resize ¶
func (pb PageBlobClient) Resize(ctx context.Context, size int64, options *ResizePageBlobOptions) (PageBlobResizeResponse, error)
Resize resizes the page blob to the specified size (which must be a multiple of 512). For more information, see https://docs.microsoft.com/rest/api/storageservices/set-blob-properties.
func (PageBlobClient) StartCopyIncremental ¶
func (pb PageBlobClient) StartCopyIncremental(ctx context.Context, source string, prevSnapshot string, options *CopyIncrementalPageBlobOptions) (PageBlobCopyIncrementalResponse, error)
StartCopyIncremental begins an operation to start an incremental copy from one page blob's snapshot to this 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. For more information, see https://docs.microsoft.com/rest/api/storageservices/incremental-copy-blob and https://docs.microsoft.com/en-us/azure/virtual-machines/windows/incremental-snapshots.
func (PageBlobClient) UpdateSequenceNumber ¶
func (pb PageBlobClient) UpdateSequenceNumber(ctx context.Context, options *UpdateSequenceNumberPageBlob) (PageBlobUpdateSequenceNumberResponse, error)
UpdateSequenceNumber sets the page blob's sequence number.
func (PageBlobClient) UploadPages ¶
func (pb PageBlobClient) UploadPages(ctx context.Context, body io.ReadSeekCloser, options *UploadPagesOptions) (PageBlobUploadPagesResponse, error)
UploadPages writes 1 or more pages to the page blob. The start offset and the stream size must be a multiple of 512 bytes. This method panics if the stream is not at position 0. Note that the http client closes the body stream after the request is sent to the service. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-page.
func (PageBlobClient) UploadPagesFromURL ¶
func (pb PageBlobClient) UploadPagesFromURL(ctx context.Context, source string, sourceOffset, destOffset, count int64, options *UploadPagesFromURLOptions) (PageBlobUploadPagesFromURLResponse, error)
UploadPagesFromURL copies 1 or more pages from a source URL to the page blob. The sourceOffset specifies the start offset of source data to copy from. The destOffset specifies the start offset of data in page blob will be written to. The count must be a multiple of 512 bytes. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-page-from-url.
func (PageBlobClient) WithSnapshot ¶
func (pb PageBlobClient) WithSnapshot(snapshot string) PageBlobClient
WithSnapshot creates a new PageBlobURL object identical to the source but with the specified snapshot timestamp. Pass "" to remove the snapshot returning a URL to the base blob.
func (PageBlobClient) WithVersionID ¶
func (pb PageBlobClient) WithVersionID(versionID string) PageBlobClient
WithVersionID creates a new PageBlobURL object identical to the source but with the specified snapshot timestamp. Pass "" to remove the version returning a URL to the base blob.
type PageBlobCopyIncrementalOptions ¶
type PageBlobCopyIncrementalOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
PageBlobCopyIncrementalOptions contains the optional parameters for the PageBlob.CopyIncremental method.
type PageBlobCopyIncrementalResponse ¶
type PageBlobCopyIncrementalResponse struct { PageBlobCopyIncrementalResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
PageBlobCopyIncrementalResponse contains the response from method PageBlob.CopyIncremental.
type PageBlobCopyIncrementalResult ¶
type PageBlobCopyIncrementalResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // CopyID contains the information returned from the x-ms-copy-id header response. CopyID *string // CopyStatus contains the information returned from the x-ms-copy-status header response. CopyStatus *CopyStatusType // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
PageBlobCopyIncrementalResult contains the result from method PageBlob.CopyIncremental.
type PageBlobCreateOptions ¶
type PageBlobCreateOptions struct { // Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be // between 0 and 2^63 - 1. BlobSequenceNumber *int64 // Optional. Used to set blob tags in various blob operations. BlobTagsString *string // Optional. Specifies 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. Note that beginning with version 2009-09-19, metadata names must adhere to the naming // rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. Metadata map[string]string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // Optional. Indicates the tier to be set on the page blob. Tier *PremiumPageBlobAccessTier // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
PageBlobCreateOptions contains the optional parameters for the PageBlob.Create method.
type PageBlobCreateResponse ¶
type PageBlobCreateResponse struct { PageBlobCreateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
PageBlobCreateResponse contains the response from method PageBlob.Create.
type PageBlobCreateResult ¶
type PageBlobCreateResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. IsServerEncrypted *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // VersionID contains the information returned from the x-ms-version-id header response. VersionID *string }
PageBlobCreateResult contains the result from method PageBlob.Create.
type PageBlobGetPageRangesDiffOptions ¶
type PageBlobGetPageRangesDiffOptions struct { // Optional. This header is only supported in service versions 2019-04-19 and after and specifies the URL of a previous snapshot of the target blob. The // response will only contain pages that were changed between the target blob and its previous snapshot. PrevSnapshotURL *string // Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that specifies that the response will contain only pages that // were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long // as the snapshot specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only for blobs created on // or after January 1, 2016. Prevsnapshot *string // Return only the bytes of the blob in the specified range. Range *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with // blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot // of a Blob.</a> Snapshot *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
PageBlobGetPageRangesDiffOptions contains the optional parameters for the PageBlob.GetPageRangesDiff method.
type PageBlobGetPageRangesDiffResponse ¶
type PageBlobGetPageRangesDiffResponse struct { PageBlobGetPageRangesDiffResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
PageBlobGetPageRangesDiffResponse contains the response from method PageBlob.GetPageRangesDiff.
type PageBlobGetPageRangesDiffResult ¶
type PageBlobGetPageRangesDiffResult struct { PageList // BlobContentLength contains the information returned from the x-ms-blob-content-length header response. BlobContentLength *int64 `xml:"BlobContentLength"` // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string `xml:"ClientRequestID"` // Date contains the information returned from the Date header response. Date *time.Time `xml:"Date"` // ETag contains the information returned from the ETag header response. ETag *string `xml:"ETag"` // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time `xml:"LastModified"` // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string `xml:"RequestID"` // Version contains the information returned from the x-ms-version header response. Version *string `xml:"Version"` }
PageBlobGetPageRangesDiffResult contains the result from method PageBlob.GetPageRangesDiff.
type PageBlobGetPageRangesOptions ¶
type PageBlobGetPageRangesOptions struct { // Return only the bytes of the blob in the specified range. Range *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with // blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot // of a Blob.</a> Snapshot *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
PageBlobGetPageRangesOptions contains the optional parameters for the PageBlob.GetPageRanges method.
type PageBlobGetPageRangesResponse ¶
type PageBlobGetPageRangesResponse struct { PageBlobGetPageRangesResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
PageBlobGetPageRangesResponse contains the response from method PageBlob.GetPageRanges.
type PageBlobGetPageRangesResult ¶
type PageBlobGetPageRangesResult struct { PageList // BlobContentLength contains the information returned from the x-ms-blob-content-length header response. BlobContentLength *int64 `xml:"BlobContentLength"` // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string `xml:"ClientRequestID"` // Date contains the information returned from the Date header response. Date *time.Time `xml:"Date"` // ETag contains the information returned from the ETag header response. ETag *string `xml:"ETag"` // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time `xml:"LastModified"` // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string `xml:"RequestID"` // Version contains the information returned from the x-ms-version header response. Version *string `xml:"Version"` }
PageBlobGetPageRangesResult contains the result from method PageBlob.GetPageRanges.
type PageBlobResizeOptions ¶
type PageBlobResizeOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
PageBlobResizeOptions contains the optional parameters for the PageBlob.Resize method.
type PageBlobResizeResponse ¶
type PageBlobResizeResponse struct { PageBlobResizeResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
PageBlobResizeResponse contains the response from method PageBlob.Resize.
type PageBlobResizeResult ¶
type PageBlobResizeResult struct { // BlobSequenceNumber contains the information returned from the x-ms-blob-sequence-number header response. BlobSequenceNumber *int64 // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
PageBlobResizeResult contains the result from method PageBlob.Resize.
type PageBlobUpdateSequenceNumberOptions ¶
type PageBlobUpdateSequenceNumberOptions struct { // Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be // between 0 and 2^63 - 1. BlobSequenceNumber *int64 // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
PageBlobUpdateSequenceNumberOptions contains the optional parameters for the PageBlob.UpdateSequenceNumber method.
type PageBlobUpdateSequenceNumberResponse ¶
type PageBlobUpdateSequenceNumberResponse struct { PageBlobUpdateSequenceNumberResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
PageBlobUpdateSequenceNumberResponse contains the response from method PageBlob.UpdateSequenceNumber.
type PageBlobUpdateSequenceNumberResult ¶
type PageBlobUpdateSequenceNumberResult struct { // BlobSequenceNumber contains the information returned from the x-ms-blob-sequence-number header response. BlobSequenceNumber *int64 // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
PageBlobUpdateSequenceNumberResult contains the result from method PageBlob.UpdateSequenceNumber.
type PageBlobUploadPagesFromURLOptions ¶
type PageBlobUploadPagesFromURLOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // Specify the md5 calculated for the range of bytes that must be read from the copy source. SourceContentMD5 []byte // Specify the crc64 calculated for the range of bytes that must be read from the copy source. SourceContentcrc64 []byte // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
PageBlobUploadPagesFromURLOptions contains the optional parameters for the PageBlob.UploadPagesFromURL method.
type PageBlobUploadPagesFromURLResponse ¶
type PageBlobUploadPagesFromURLResponse struct { PageBlobUploadPagesFromURLResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
PageBlobUploadPagesFromURLResponse contains the response from method PageBlob.UploadPagesFromURL.
type PageBlobUploadPagesFromURLResult ¶
type PageBlobUploadPagesFromURLResult struct { // BlobSequenceNumber contains the information returned from the x-ms-blob-sequence-number header response. BlobSequenceNumber *int64 // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. IsServerEncrypted *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // XMSContentCRC64 contains the information returned from the x-ms-content-crc64 header response. XMSContentCRC64 []byte }
PageBlobUploadPagesFromURLResult contains the result from method PageBlob.UploadPagesFromURL.
type PageBlobUploadPagesOptions ¶
type PageBlobUploadPagesOptions struct { // Return only the bytes of the blob in the specified range. Range *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // Specify the transactional crc64 for the body, to be validated by the service. TransactionalContentCRC64 []byte // Specify the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 []byte }
PageBlobUploadPagesOptions contains the optional parameters for the PageBlob.UploadPages method.
type PageBlobUploadPagesResponse ¶
type PageBlobUploadPagesResponse struct { PageBlobUploadPagesResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
PageBlobUploadPagesResponse contains the response from method PageBlob.UploadPages.
type PageBlobUploadPagesResult ¶
type PageBlobUploadPagesResult struct { // BlobSequenceNumber contains the information returned from the x-ms-blob-sequence-number header response. BlobSequenceNumber *int64 // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // ContentMD5 contains the information returned from the Content-MD5 header response. ContentMD5 []byte // Date contains the information returned from the Date header response. Date *time.Time // ETag contains the information returned from the ETag header response. ETag *string // EncryptionKeySHA256 contains the information returned from the x-ms-encryption-key-sha256 header response. EncryptionKeySHA256 *string // EncryptionScope contains the information returned from the x-ms-encryption-scope header response. EncryptionScope *string // IsServerEncrypted contains the information returned from the x-ms-request-server-encrypted header response. IsServerEncrypted *bool // LastModified contains the information returned from the Last-Modified header response. LastModified *time.Time // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string // XMSContentCRC64 contains the information returned from the x-ms-content-crc64 header response. XMSContentCRC64 []byte }
PageBlobUploadPagesResult contains the result from method PageBlob.UploadPages.
type PageList ¶
type PageList struct { ClearRange []*ClearRange `xml:"ClearRange"` PageRange []*PageRange `xml:"PageRange"` }
PageList - the list of pages
func (PageList) MarshalXML ¶
MarshalXML implements the xml.Marshaller interface for type PageList.
type PageRange ¶
func (*PageRange) Raw ¶
type PathRenameMode ¶
type PathRenameMode string
const ( PathRenameModeLegacy PathRenameMode = "legacy" PathRenameModePosix PathRenameMode = "posix" )
func PossiblePathRenameModeValues ¶
func PossiblePathRenameModeValues() []PathRenameMode
PossiblePathRenameModeValues returns the possible values for the PathRenameMode const type.
func (PathRenameMode) ToPtr ¶
func (c PathRenameMode) ToPtr() *PathRenameMode
ToPtr returns a *PathRenameMode pointing to the current value.
type PremiumPageBlobAccessTier ¶
type PremiumPageBlobAccessTier string
const ( PremiumPageBlobAccessTierP10 PremiumPageBlobAccessTier = "P10" PremiumPageBlobAccessTierP15 PremiumPageBlobAccessTier = "P15" PremiumPageBlobAccessTierP20 PremiumPageBlobAccessTier = "P20" PremiumPageBlobAccessTierP30 PremiumPageBlobAccessTier = "P30" PremiumPageBlobAccessTierP4 PremiumPageBlobAccessTier = "P4" PremiumPageBlobAccessTierP40 PremiumPageBlobAccessTier = "P40" PremiumPageBlobAccessTierP50 PremiumPageBlobAccessTier = "P50" PremiumPageBlobAccessTierP6 PremiumPageBlobAccessTier = "P6" PremiumPageBlobAccessTierP60 PremiumPageBlobAccessTier = "P60" PremiumPageBlobAccessTierP70 PremiumPageBlobAccessTier = "P70" PremiumPageBlobAccessTierP80 PremiumPageBlobAccessTier = "P80" )
func PossiblePremiumPageBlobAccessTierValues ¶
func PossiblePremiumPageBlobAccessTierValues() []PremiumPageBlobAccessTier
PossiblePremiumPageBlobAccessTierValues returns the possible values for the PremiumPageBlobAccessTier const type.
func (PremiumPageBlobAccessTier) ToPtr ¶
func (c PremiumPageBlobAccessTier) ToPtr() *PremiumPageBlobAccessTier
ToPtr returns a *PremiumPageBlobAccessTier pointing to the current value.
type PublicAccessType ¶
type PublicAccessType string
const ( PublicAccessTypeBlob PublicAccessType = "blob" PublicAccessTypeContainer PublicAccessType = "container" )
func PossiblePublicAccessTypeValues ¶
func PossiblePublicAccessTypeValues() []PublicAccessType
PossiblePublicAccessTypeValues returns the possible values for the PublicAccessType const type.
func (PublicAccessType) ToPtr ¶
func (c PublicAccessType) ToPtr() *PublicAccessType
ToPtr returns a *PublicAccessType pointing to the current value.
type QueryFormat ¶
type QueryFormat struct { // Groups the settings used for interpreting the blob data if the blob is delimited text formatted. DelimitedTextConfiguration *DelimitedTextConfiguration `xml:"DelimitedTextConfiguration"` // json text configuration JSONTextConfiguration *JSONTextConfiguration `xml:"JsonTextConfiguration"` // The quick query format type. Type *QueryFormatType `xml:"Type"` }
type QueryFormatType ¶
type QueryFormatType string
QueryFormatType - The quick query format type.
const ( QueryFormatTypeDelimited QueryFormatType = "delimited" QueryFormatTypeJSON QueryFormatType = "json" )
func PossibleQueryFormatTypeValues ¶
func PossibleQueryFormatTypeValues() []QueryFormatType
PossibleQueryFormatTypeValues returns the possible values for the QueryFormatType const type.
func (QueryFormatType) ToPtr ¶
func (c QueryFormatType) ToPtr() *QueryFormatType
ToPtr returns a *QueryFormatType pointing to the current value.
type QueryRequest ¶
type QueryRequest struct { // REQUIRED; The query expression in SQL. The maximum size of the query expression is 256KiB. Expression *string `xml:"Expression"` // REQUIRED; Required. The type of the provided query expression. QueryType *string `xml:"QueryType"` InputSerialization *QuerySerialization `xml:"InputSerialization"` OutputSerialization *QuerySerialization `xml:"OutputSerialization"` }
QueryRequest - Groups the set of query request settings.
func (QueryRequest) MarshalXML ¶
func (q QueryRequest) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaller interface for type QueryRequest.
type QuerySerialization ¶
type QuerySerialization struct { // REQUIRED Format *QueryFormat `xml:"Format"` }
type RehydratePriority ¶
type RehydratePriority string
RehydratePriority - If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High and Standard.
const ( RehydratePriorityHigh RehydratePriority = "High" RehydratePriorityStandard RehydratePriority = "Standard" )
func PossibleRehydratePriorityValues ¶
func PossibleRehydratePriorityValues() []RehydratePriority
PossibleRehydratePriorityValues returns the possible values for the RehydratePriority const type.
func (RehydratePriority) ToPtr ¶
func (c RehydratePriority) ToPtr() *RehydratePriority
ToPtr returns a *RehydratePriority pointing to the current value.
type ReleaseLeaseBlobOptions ¶
type ReleaseLeaseBlobOptions struct { ModifiedAccessConditions *ModifiedAccessConditions }
type ReleaseLeaseContainerOptions ¶
type ReleaseLeaseContainerOptions struct { ModifiedAccessConditions *ModifiedAccessConditions }
type RenewLeaseBlobOptions ¶
type RenewLeaseBlobOptions struct { ModifiedAccessConditions *ModifiedAccessConditions }
type RenewLeaseContainerOptions ¶
type RenewLeaseContainerOptions struct { ModifiedAccessConditions *ModifiedAccessConditions }
type ResizePageBlobOptions ¶
type ResizePageBlobOptions struct { CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo BlobAccessConditions *BlobAccessConditions }
type ResponseError ¶
type ResponseError interface { Error() string Unwrap() error RawResponse() *http.Response NonRetriable() }
type RetentionPolicy ¶
type RetentionPolicy struct { // REQUIRED; Indicates whether a retention policy is enabled for the storage service Enabled *bool `xml:"Enabled"` // Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted Days *int32 `xml:"Days"` }
RetentionPolicy - the retention policy which determines how long the associated data should persist
type RetryReaderOptions ¶
type RetryReaderOptions struct { // MaxRetryRequests specifies the maximum number of HTTP GET requests that will be made // while reading from a RetryReader. A value of zero means that no additional HTTP // GET requests will be made. MaxRetryRequests int // NotifyFailedRead is called, if non-nil, after any failure to read. Expected usage is diagnostic logging. NotifyFailedRead FailedReadNotifier // TreatEarlyCloseAsError can be set to true to prevent retries after "read on closed response body". By default, // retryReader has the following special behaviour: closing the response body before it is all read is treated as a // retryable error. This is to allow callers to force a retry by closing the body from another goroutine (e.g. if the = // read is too slow, caller may want to force a retry in the hope that the retry will be quicker). If // TreatEarlyCloseAsError is true, then retryReader's special behaviour is suppressed, and "read on closed body" is instead // treated as a fatal (non-retryable) error. // Note that setting TreatEarlyCloseAsError only guarantees that Closing will produce a fatal error if the Close happens // from the same "thread" (goroutine) as Read. Concurrent Close calls from other goroutines may instead produce network errors // which will be retried. TreatEarlyCloseAsError bool CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo // contains filtered or unexported fields }
RetryReaderOptions contains properties which can help to decide when to do retry.
type SASProtocol ¶
type SASProtocol string
SASProtocol indicates the http/https.
const ( // SASProtocolHTTPS can be specified for a SAS protocol SASProtocolHTTPS SASProtocol = "https" )
type SASQueryParameters ¶
type SASQueryParameters struct {
// contains filtered or unexported fields
}
A SASQueryParameters object represents the components that make up an Azure Storage SAS' query parameters. You parse a map of query parameters into its fields by calling NewSASQueryParameters(). You add the components to a query parameter map by calling AddToValues(). NOTE: Changing any field requires computing a new SAS signature using a XxxSASSignatureValues type.
This type defines the components used by all Azure Storage resources (Containers, Blobs, Files, & Queues).
func (*SASQueryParameters) CacheControl ¶
func (p *SASQueryParameters) CacheControl() string
func (*SASQueryParameters) ContentDisposition ¶
func (p *SASQueryParameters) ContentDisposition() string
func (*SASQueryParameters) ContentEncoding ¶
func (p *SASQueryParameters) ContentEncoding() string
func (*SASQueryParameters) ContentLanguage ¶
func (p *SASQueryParameters) ContentLanguage() string
func (*SASQueryParameters) ContentType ¶
func (p *SASQueryParameters) ContentType() string
func (*SASQueryParameters) Encode ¶
func (p *SASQueryParameters) Encode() string
Encode encodes the SAS query parameters into URL encoded form sorted by key.
func (*SASQueryParameters) ExpiryTime ¶
func (p *SASQueryParameters) ExpiryTime() time.Time
func (*SASQueryParameters) IPRange ¶
func (p *SASQueryParameters) IPRange() IPRange
func (*SASQueryParameters) Identifier ¶
func (p *SASQueryParameters) Identifier() string
func (*SASQueryParameters) Permissions ¶
func (p *SASQueryParameters) Permissions() string
func (*SASQueryParameters) Protocol ¶
func (p *SASQueryParameters) Protocol() SASProtocol
func (*SASQueryParameters) Resource ¶
func (p *SASQueryParameters) Resource() string
func (*SASQueryParameters) ResourceTypes ¶
func (p *SASQueryParameters) ResourceTypes() string
func (*SASQueryParameters) Services ¶
func (p *SASQueryParameters) Services() string
func (*SASQueryParameters) Signature ¶
func (p *SASQueryParameters) Signature() string
func (*SASQueryParameters) SignedExpiry ¶
func (p *SASQueryParameters) SignedExpiry() time.Time
func (*SASQueryParameters) SignedOid ¶
func (p *SASQueryParameters) SignedOid() string
func (*SASQueryParameters) SignedService ¶
func (p *SASQueryParameters) SignedService() string
func (*SASQueryParameters) SignedStart ¶
func (p *SASQueryParameters) SignedStart() time.Time
func (*SASQueryParameters) SignedTid ¶
func (p *SASQueryParameters) SignedTid() string
func (*SASQueryParameters) SignedVersion ¶
func (p *SASQueryParameters) SignedVersion() string
func (*SASQueryParameters) SnapshotTime ¶
func (p *SASQueryParameters) SnapshotTime() time.Time
func (*SASQueryParameters) StartTime ¶
func (p *SASQueryParameters) StartTime() time.Time
func (*SASQueryParameters) Version ¶
func (p *SASQueryParameters) Version() string
type SKUName ¶
type SKUName string
const ( SKUNameStandardLRS SKUName = "Standard_LRS" SKUNameStandardGRS SKUName = "Standard_GRS" SKUNameStandardRAGRS SKUName = "Standard_RAGRS" SKUNameStandardZRS SKUName = "Standard_ZRS" SKUNamePremiumLRS SKUName = "Premium_LRS" )
func PossibleSKUNameValues ¶
func PossibleSKUNameValues() []SKUName
PossibleSKUNameValues returns the possible values for the SKUName const type.
func (SKUName) ToPtr ¶
ToPtr returns a *SKUName pointing to the current value.
type SealAppendBlobOptions ¶
type SealAppendBlobOptions struct { BlobAccessConditions *BlobAccessConditions AppendPositionAccessConditions *AppendPositionAccessConditions }
type SequenceNumberAccessConditions ¶
type SequenceNumberAccessConditions struct { // Specify this header value to operate only on a blob if it has the specified sequence number. IfSequenceNumberEqualTo *int64 // Specify this header value to operate only on a blob if it has a sequence number less than the specified. IfSequenceNumberLessThan *int64 // Specify this header value to operate only on a blob if it has a sequence number less than or equal to the specified. IfSequenceNumberLessThanOrEqualTo *int64 }
SequenceNumberAccessConditions contains a group of parameters for the PageBlob.UploadPages method.
type SequenceNumberActionType ¶
type SequenceNumberActionType string
const ( SequenceNumberActionTypeMax SequenceNumberActionType = "max" SequenceNumberActionTypeUpdate SequenceNumberActionType = "update" SequenceNumberActionTypeIncrement SequenceNumberActionType = "increment" )
func PossibleSequenceNumberActionTypeValues ¶
func PossibleSequenceNumberActionTypeValues() []SequenceNumberActionType
PossibleSequenceNumberActionTypeValues returns the possible values for the SequenceNumberActionType const type.
func (SequenceNumberActionType) ToPtr ¶
func (c SequenceNumberActionType) ToPtr() *SequenceNumberActionType
ToPtr returns a *SequenceNumberActionType pointing to the current value.
type ServiceClient ¶
type ServiceClient struct {
// contains filtered or unexported fields
}
A ServiceClient represents a URL to the Azure Storage Blob service allowing you to manipulate blob containers.
func NewServiceClient ¶
func NewServiceClient(serviceURL string, cred azcore.Credential, options *ClientOptions) (ServiceClient, error)
NewServiceClient creates a ServiceClient object using the specified URL, credential, and options. Example of serviceURL: https://<your_storage_account>.blob.core.windows.net
func NewServiceClientFromConnectionString ¶
func NewServiceClientFromConnectionString(connectionString string, options *ClientOptions) (ServiceClient, error)
NewServiceClientFromConnectionString creates a service client from the given connection string. nolint
func (ServiceClient) CanGetAccountSASToken ¶
func (s ServiceClient) CanGetAccountSASToken() bool
func (ServiceClient) CreateContainer ¶
func (s ServiceClient) CreateContainer(ctx context.Context, containerName string, options *CreateContainerOptions) (ContainerCreateResponse, error)
CreateContainer is a lifecycle method to creates a new container under the specified account. If the container with the same name already exists, a ResourceExistsError will be raised. This method returns a client with which to interact with the newly created container.
func (ServiceClient) DeleteContainer ¶
func (s ServiceClient) DeleteContainer(ctx context.Context, containerName string, options *DeleteContainerOptions) (ContainerDeleteResponse, error)
DeleteContainer is a lifecycle method that marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. If the container is not found, a ResourceNotFoundError will be raised.
func (ServiceClient) FindBlobsByTags ¶
func (s ServiceClient) FindBlobsByTags(ctx context.Context, options ServiceFilterBlobsByTagsOptions) (ServiceFilterBlobsResponse, error)
FindBlobsByTags operation finds all blobs in the storage account whose tags match a given search expression. Filter blobs searches across all containers within a storage account but can be scoped within the expression to a single container. https://docs.microsoft.com/en-us/rest/api/storageservices/find-blobs-by-tags eg. "dog='germanshepherd' and penguin='emperorpenguin'" To specify a container, eg. "@container=’containerName’ and Name = ‘C’"
func (ServiceClient) GetAccountInfo ¶
func (s ServiceClient) GetAccountInfo(ctx context.Context) (ServiceGetAccountInfoResponse, error)
func (ServiceClient) GetProperties ¶
func (s ServiceClient) GetProperties(ctx context.Context) (ServiceGetPropertiesResponse, error)
GetProperties - gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
func (ServiceClient) GetSASToken ¶
func (s ServiceClient) GetSASToken(resources AccountSASResourceTypes, permissions AccountSASPermissions, services AccountSASServices, start time.Time, expiry time.Time) (string, error)
GetSASToken is a convenience method for generating a SAS token for the currently pointed at account.
It can only be used if the supplied azcore.Credential during creation was a SharedKeyCredential.
This validity can be checked with CanGetAccountSASToken().
This example demonstrates how to use the SAS token convenience generators.
Though this example focuses on account SAS, these generators exist across all clients (Service, Container, Blob, and specialized Blob clients)
Code:
Example¶
{
// Initialize a service client
accountName, accountKey := accountInfo()
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
log.Fatal(err)
}
serviceClient, err := NewServiceClient(fmt.Sprintf("https://%s.blob.core.windows.net/", accountName), credential, nil)
if err != nil {
log.Fatal(err)
}
// Provide the convenience function with relevant info (services, resource types, permissions, and duration)
// The SAS token will be valid from this moment onwards.
accountSAS, err := serviceClient.GetSASToken(AccountSASResourceTypes{Object: true, Service: true, Container: true},
AccountSASPermissions{Read: true, List: true}, AccountSASServices{Blob: true}, time.Now(), time.Now().Add(48*time.Hour))
if err != nil {
log.Fatal(err)
}
urlToSend := fmt.Sprintf("https://%s.blob.core.windows.net/?%s", accountName, accountSAS)
// You can hand off this URL to someone else via any mechanism you choose.
// ******************************************
// When someone receives the URL, they can access the resource using it in code like this, or a tool of some variety.
serviceClient, err = NewServiceClient(urlToSend, azcore.NewAnonymousCredential(), nil)
if err != nil {
log.Fatal(err)
}
// You can also break a blob URL up into it's constituent parts
blobURLParts := NewBlobURLParts(serviceClient.URL())
fmt.Printf("SAS expiry time = %s\n", blobURLParts.SAS.ExpiryTime())
}
func (ServiceClient) GetStatistics ¶
func (s ServiceClient) GetStatistics(ctx context.Context) (ServiceGetStatisticsResponse, error)
GetStatistics Retrieves statistics related to replication for the Blob service. It is only available when read-access geo-redundant replication is enabled for the storage account. With geo-redundant replication, Azure Storage maintains your data durable in two locations. In both locations, Azure Storage constantly maintains multiple healthy replicas of your data. The location where you read, create, update, or delete data is the primary storage account location. The primary location exists in the region you choose at the time you create an account via the Azure Management Azure classic portal, for example, North Central US. The location to which your data is replicated is the secondary location. The secondary location is automatically determined based on the location of the primary; it is in a second data center that resides in the same region as the primary location. Read-only access is available from the secondary location, if read-access geo-redundant replication is enabled for your storage account.
func (ServiceClient) ListContainers ¶
func (s ServiceClient) ListContainers(o *ListContainersOptions) *ServiceListContainersSegmentPager
The ListContainers operation returns a pager of the containers under the specified account. Use an empty Marker to start enumeration from the beginning. Container names are returned in lexicographic order. For more information, see https://docs.microsoft.com/rest/api/storageservices/list-containers2.
func (ServiceClient) NewContainerClient ¶
func (s ServiceClient) NewContainerClient(containerName string) ContainerClient
NewContainerClient creates a new ContainerClient object by concatenating containerName to the end of ServiceClient's URL. The new ContainerClient uses the same request policy pipeline as the ServiceClient. To change the pipeline, create the ContainerClient and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewContainerClient instead of calling this object's NewContainerClient method.
func (ServiceClient) SetProperties ¶
func (s ServiceClient) SetProperties(ctx context.Context, properties StorageServiceProperties) (ServiceSetPropertiesResponse, error)
SetProperties Sets the properties of a storage account's Blob service, including Azure Storage Analytics. If an element (e.g. analytics_logging) is left as None, the existing settings on the service for that functionality are preserved.
func (ServiceClient) URL ¶
func (s ServiceClient) URL() string
URL returns the URL endpoint used by the ServiceClient object.
type ServiceFilterBlobsByTagsOptions ¶
type ServiceFilterBlobsByTagsOptions struct { // A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker // value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value // can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client. Marker *string // Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server // will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for // retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or // than the default of 5000. Maxresults *int32 // Filters the results to return only to return only blobs whose tags match the specified expression. Where *string }
type ServiceFilterBlobsOptions ¶
type ServiceFilterBlobsOptions struct { // A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker // value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value // can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client. Marker *string // Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server // will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for // retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or // than the default of 5000. Maxresults *int32 // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 // Filters the results to return only to return only blobs whose tags match the specified expression. Where *string }
ServiceFilterBlobsOptions contains the optional parameters for the Service.FilterBlobs method.
type ServiceFilterBlobsResponse ¶
type ServiceFilterBlobsResponse struct { ServiceFilterBlobsResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ServiceFilterBlobsResponse contains the response from method Service.FilterBlobs.
type ServiceFilterBlobsResult ¶
type ServiceFilterBlobsResult struct { FilterBlobSegment // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string `xml:"ClientRequestID"` // Date contains the information returned from the Date header response. Date *time.Time `xml:"Date"` // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string `xml:"RequestID"` // Version contains the information returned from the x-ms-version header response. Version *string `xml:"Version"` }
ServiceFilterBlobsResult contains the result from method Service.FilterBlobs.
type ServiceGetAccountInfoOptions ¶
type ServiceGetAccountInfoOptions struct { }
ServiceGetAccountInfoOptions contains the optional parameters for the Service.GetAccountInfo method.
type ServiceGetAccountInfoResponse ¶
type ServiceGetAccountInfoResponse struct { ServiceGetAccountInfoResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ServiceGetAccountInfoResponse contains the response from method Service.GetAccountInfo.
type ServiceGetAccountInfoResult ¶
type ServiceGetAccountInfoResult struct { // AccountKind contains the information returned from the x-ms-account-kind header response. AccountKind *AccountKind // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // Date contains the information returned from the Date header response. Date *time.Time // IsHierarchicalNamespaceEnabled contains the information returned from the x-ms-is-hns-enabled header response. IsHierarchicalNamespaceEnabled *bool // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // SKUName contains the information returned from the x-ms-sku-name header response. SKUName *SKUName // Version contains the information returned from the x-ms-version header response. Version *string }
ServiceGetAccountInfoResult contains the result from method Service.GetAccountInfo.
type ServiceGetPropertiesOptions ¶
type ServiceGetPropertiesOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ServiceGetPropertiesOptions contains the optional parameters for the Service.GetProperties method.
type ServiceGetPropertiesResponse ¶
type ServiceGetPropertiesResponse struct { ServiceGetPropertiesResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ServiceGetPropertiesResponse contains the response from method Service.GetProperties.
type ServiceGetPropertiesResult ¶
type ServiceGetPropertiesResult struct { StorageServiceProperties // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string `xml:"ClientRequestID"` // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string `xml:"RequestID"` // Version contains the information returned from the x-ms-version header response. Version *string `xml:"Version"` }
ServiceGetPropertiesResult contains the result from method Service.GetProperties.
type ServiceGetStatisticsOptions ¶
type ServiceGetStatisticsOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ServiceGetStatisticsOptions contains the optional parameters for the Service.GetStatistics method.
type ServiceGetStatisticsResponse ¶
type ServiceGetStatisticsResponse struct { ServiceGetStatisticsResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ServiceGetStatisticsResponse contains the response from method Service.GetStatistics.
type ServiceGetStatisticsResult ¶
type ServiceGetStatisticsResult struct { StorageServiceStats // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string `xml:"ClientRequestID"` // Date contains the information returned from the Date header response. Date *time.Time `xml:"Date"` // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string `xml:"RequestID"` // Version contains the information returned from the x-ms-version header response. Version *string `xml:"Version"` }
ServiceGetStatisticsResult contains the result from method Service.GetStatistics.
type ServiceGetUserDelegationKeyOptions ¶
type ServiceGetUserDelegationKeyOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ServiceGetUserDelegationKeyOptions contains the optional parameters for the Service.GetUserDelegationKey method.
type ServiceGetUserDelegationKeyResponse ¶
type ServiceGetUserDelegationKeyResponse struct { ServiceGetUserDelegationKeyResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ServiceGetUserDelegationKeyResponse contains the response from method Service.GetUserDelegationKey.
type ServiceGetUserDelegationKeyResult ¶
type ServiceGetUserDelegationKeyResult struct { UserDelegationKey // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string `xml:"ClientRequestID"` // Date contains the information returned from the Date header response. Date *time.Time `xml:"Date"` // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string `xml:"RequestID"` // Version contains the information returned from the x-ms-version header response. Version *string `xml:"Version"` }
ServiceGetUserDelegationKeyResult contains the result from method Service.GetUserDelegationKey.
type ServiceListContainersSegmentOptions ¶
type ServiceListContainersSegmentOptions struct { // Include this parameter to specify that the container's metadata be returned as part of the response body. Include []ListContainersIncludeType // A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker // value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value // can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client. Marker *string // Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server // will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for // retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or // than the default of 5000. Maxresults *int32 // Filters the results to return only containers whose name begins with the specified prefix. Prefix *string // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ServiceListContainersSegmentOptions contains the optional parameters for the Service.ListContainers method.
type ServiceListContainersSegmentPager ¶
type ServiceListContainersSegmentPager struct {
// contains filtered or unexported fields
}
ServiceListContainersSegmentPager provides operations for iterating over paged responses.
func (*ServiceListContainersSegmentPager) Err ¶
func (p *ServiceListContainersSegmentPager) Err() error
Err returns the last error encountered while paging.
func (*ServiceListContainersSegmentPager) NextPage ¶
func (p *ServiceListContainersSegmentPager) NextPage(ctx context.Context) bool
NextPage returns true if the pager advanced to the next page. Returns false if there are no more pages or an error occurred.
func (*ServiceListContainersSegmentPager) PageResponse ¶
func (p *ServiceListContainersSegmentPager) PageResponse() ServiceListContainersSegmentResponse
PageResponse returns the current ServiceListContainersSegmentResponse page.
type ServiceListContainersSegmentResponse ¶
type ServiceListContainersSegmentResponse struct { ServiceListContainersSegmentResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ServiceListContainersSegmentResponse contains the response from method Service.ListContainers.
type ServiceListContainersSegmentResult ¶
type ServiceListContainersSegmentResult struct { ListContainersSegmentResponse // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string `xml:"ClientRequestID"` // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string `xml:"RequestID"` // Version contains the information returned from the x-ms-version header response. Version *string `xml:"Version"` }
ServiceListContainersSegmentResult contains the result from method Service.ListContainers.
type ServiceSetPropertiesOptions ¶
type ServiceSetPropertiesOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ServiceSetPropertiesOptions contains the optional parameters for the Service.SetProperties method.
type ServiceSetPropertiesResponse ¶
type ServiceSetPropertiesResponse struct { ServiceSetPropertiesResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ServiceSetPropertiesResponse contains the response from method Service.SetProperties.
type ServiceSetPropertiesResult ¶
type ServiceSetPropertiesResult struct { // ClientRequestID contains the information returned from the x-ms-client-request-id header response. ClientRequestID *string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
ServiceSetPropertiesResult contains the result from method Service.SetProperties.
type ServiceSubmitBatchOptions ¶
type ServiceSubmitBatchOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting // Timeouts for Blob Service Operations.</a> Timeout *int32 }
ServiceSubmitBatchOptions contains the optional parameters for the Service.SubmitBatch method.
type ServiceSubmitBatchResponse ¶
type ServiceSubmitBatchResponse struct { ServiceSubmitBatchResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response }
ServiceSubmitBatchResponse contains the response from method Service.SubmitBatch.
type ServiceSubmitBatchResult ¶
type ServiceSubmitBatchResult struct { // ContentType contains the information returned from the Content-Type header response. ContentType *string // RequestID contains the information returned from the x-ms-request-id header response. RequestID *string // Version contains the information returned from the x-ms-version header response. Version *string }
ServiceSubmitBatchResult contains the result from method Service.SubmitBatch.
type SetAccessPolicyOptions ¶
type SetAccessPolicyOptions struct { // At least Access and ContainerACL must be specified ContainerSetAccessPolicyOptions ContainerSetAccessPolicyOptions AccessConditions *ContainerAccessConditions }
type SetBlobHTTPHeadersOptions ¶
type SetBlobHTTPHeadersOptions struct { LeaseAccessConditions *LeaseAccessConditions ModifiedAccessConditions *ModifiedAccessConditions }
type SetBlobMetadataOptions ¶
type SetBlobMetadataOptions struct { LeaseAccessConditions *LeaseAccessConditions CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo ModifiedAccessConditions *ModifiedAccessConditions }
type SetMetadataContainerOptions ¶
type SetMetadataContainerOptions struct { Metadata map[string]string LeaseAccessConditions *LeaseAccessConditions ModifiedAccessConditions *ModifiedAccessConditions }
type SetTagsBlobOptions ¶
type SetTagsBlobOptions struct { // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // The timeout parameter is expressed in seconds. Timeout *int32 // The version id parameter is an opaque DateTime value that, when present, // specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. VersionID *string // Optional header, Specifies the transactional crc64 for the body, to be validated by the service. TransactionalContentCRC64 []byte // Optional header, Specifies the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 []byte TagsMap map[string]string ModifiedAccessConditions *ModifiedAccessConditions }
type SetTierOptions ¶
type SetTierOptions struct { // Optional: Indicates the priority with which to rehydrate an archived blob. RehydratePriority *RehydratePriority LeaseAccessConditions *LeaseAccessConditions ModifiedAccessConditions *ModifiedAccessConditions }
type SharedKeyCredential ¶
type SharedKeyCredential struct {
// contains filtered or unexported fields
}
SharedKeyCredential contains an account's name and its primary or secondary key. It is immutable making it shareable and goroutine-safe.
func NewSharedKeyCredential ¶
func NewSharedKeyCredential(accountName string, accountKey string) (*SharedKeyCredential, error)
NewSharedKeyCredential creates an immutable SharedKeyCredential containing the storage account's name and either its primary or secondary key.
func (*SharedKeyCredential) AccountName ¶
func (c *SharedKeyCredential) AccountName() string
AccountName returns the Storage account's name.
func (*SharedKeyCredential) ComputeHMACSHA256 ¶
func (c *SharedKeyCredential) ComputeHMACSHA256(message string) (string, error)
ComputeHMACSHA256 generates a hash signature for an HTTP request or for a SAS.
func (*SharedKeyCredential) NewAuthenticationPolicy ¶
func (c *SharedKeyCredential) NewAuthenticationPolicy(options runtime.AuthenticationOptions) policy.Policy
NewAuthenticationPolicy implements the Credential interface on SharedKeyCredential.
func (*SharedKeyCredential) SetAccountKey ¶
func (c *SharedKeyCredential) SetAccountKey(accountKey string) error
SetAccountKey replaces the existing account key with the specified account key.
type SignedIdentifier ¶
type SignedIdentifier struct { // REQUIRED; An Access policy AccessPolicy *AccessPolicy `xml:"AccessPolicy"` // REQUIRED; a unique id ID *string `xml:"Id"` }
SignedIdentifier - signed identifier
type SourceModifiedAccessConditions ¶
type SourceModifiedAccessConditions struct { // Specify an ETag value to operate only on blobs with a matching value. SourceIfMatch *string // Specify this header value to operate only on a blob if it has been modified since the specified date/time. SourceIfModifiedSince *time.Time // Specify an ETag value to operate only on blobs without a matching value. SourceIfNoneMatch *string // Specify a SQL where clause on blob tags to operate only on blobs with a matching value. SourceIfTags *string // Specify this header value to operate only on a blob if it has not been modified since the specified date/time. SourceIfUnmodifiedSince *time.Time }
SourceModifiedAccessConditions contains a group of parameters for the Directory.Rename method.
type StageBlockFromURLOptions ¶
type StageBlockFromURLOptions struct { LeaseAccessConditions *LeaseAccessConditions SourceModifiedAccessConditions *SourceModifiedAccessConditions // Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. RequestID *string // Specify the md5 calculated for the range of bytes that must be read from the copy source. SourceContentMD5 []byte // Specify the crc64 calculated for the range of bytes that must be read from the copy source. SourceContentcrc64 []byte Offset *int64 Count *int64 // The timeout parameter is expressed in seconds. Timeout *int32 CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo }
type StageBlockOptions ¶
type StageBlockOptions struct { CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo LeaseAccessConditions *LeaseAccessConditions BlockBlobStageBlockOptions *BlockBlobStageBlockOptions }
type StartCopyBlobOptions ¶
type StartCopyBlobOptions struct { // Optional. Used to set blob tags in various blob operations. TagsMap map[string]string // Optional. Specifies 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. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. // See Naming and Referencing Containers, Blobs, and Metadata for more information. Metadata map[string]string // Optional: Indicates the priority with which to rehydrate an archived blob. RehydratePriority *RehydratePriority // Overrides the sealed state of the destination blob. Service version 2019-12-12 and newer. SealBlob *bool // Optional. Indicates the tier to be set on the blob. Tier *AccessTier SourceModifiedAccessConditions *SourceModifiedAccessConditions ModifiedAccessConditions *ModifiedAccessConditions LeaseAccessConditions *LeaseAccessConditions }
type StaticWebsite ¶
type StaticWebsite struct { // REQUIRED; Indicates whether this account is hosting a static website Enabled *bool `xml:"Enabled"` // Absolute path of the default index page DefaultIndexDocumentPath *string `xml:"DefaultIndexDocumentPath"` // The absolute path of the custom 404 page ErrorDocument404Path *string `xml:"ErrorDocument404Path"` // The default name of the index page under each directory IndexDocument *string `xml:"IndexDocument"` }
StaticWebsite - The properties that enable an account to host a static website
type StorageError ¶
type StorageError struct { ErrorCode StorageErrorCode // contains filtered or unexported fields }
StorageError is the internal struct that replaces the generated StorageError.
TL;DR: This implements xml.Unmarshaler, and when the original StorageError is substituted, this unmarshaler kicks in.
This handles the description and details. defunkifyStorageError handles the response, cause, and service code.
Awaiting Mohit's test PR, StorageError is barren for now.
Code:
Example¶
{
/* This example demonstrates how to handle errors returned from the various Client methods. All these methods return an
object implementing the azcore.Response interface and an object implementing Go's error interface.
The error result is nil if the request was successful; your code can safely use the Response interface object.
If the error is non-nil, the error could be due to:
1. An invalid argument passed to the method. You should not write code to handle these errors;
instead, fix these errors as they appear during development/testing.
2. A network request didn't reach an Azure Storage Service. This usually happens due to a bad URL or
faulty networking infrastructure (like a router issue). In this case, an object implementing the
net.Error interface will be returned. The net.Error interface offers Timeout and Temporary methods
which return true if the network error is determined to be a timeout or temporary condition. If
your pipeline uses the retry policy factory, then this policy looks for Timeout/Temporary and
automatically retries based on the retry options you've configured. Because of the retry policy,
your code will usually not call the Timeout/Temporary methods explicitly other than possibly logging
the network failure.
3. A network request did reach the Azure Storage Service but the service failed to perform the
requested operation. In this case, an object implementing the StorageError interface is returned.
The StorageError interface also implements the net.Error interface and, if you use the retry policy,
you would most likely ignore the Timeout/Temporary methods. However, the StorageError interface exposes
richer information such as a service error code, an error description, details data, and the
service-returned http.Response. And, from the http.Response, you can get the initiating http.Request.
*/
container, err := NewContainerClient("https://myaccount.blob.core.windows.net/mycontainer", azcore.NewAnonymousCredential(), nil)
if err != nil {
log.Fatal(err)
}
_, err = container.Create(context.Background(), nil)
if err != nil { // an error occurred
var stgErr StorageError
if errors.As(err, &stgErr) { // We know this error is service-specific
switch stgErr.ErrorCode {
case StorageErrorCodeContainerAlreadyExists:
// You can also look at the *http.Response that's attached to the error as well.
if resp := stgErr.Response(); resp != nil {
failedRequest := resp.Request
_ = failedRequest // avoid compiler's declared but not used error
}
case StorageErrorCodeContainerBeingDeleted:
// Handle this error ...
default:
// Handle other errors ...
}
}
}
}
func (StorageError) Error ¶
func (e StorageError) Error() string
Error implements the error interface's Error method to return a string representation of the error.
func (StorageError) Is ¶
func (e StorageError) Is(err error) bool
func (StorageError) Response ¶
func (e StorageError) Response() *http.Response
func (*StorageError) StatusCode ¶
func (e *StorageError) StatusCode() int
StatusCode returns service-error information. The caller may examine these values but should not modify any of them.
func (*StorageError) Temporary ¶
func (e *StorageError) Temporary() bool
Temporary returns true if the error occurred due to a temporary condition (including an HTTP status of 500 or 503).
func (*StorageError) UnmarshalXML ¶
func (e *StorageError) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
UnmarshalXML performs custom unmarshalling of XML-formatted Azure storage request errors. nolint
type StorageErrorCode ¶
type StorageErrorCode string
StorageErrorCode - Error codes returned by the service
const ( StorageErrorCodeAccountAlreadyExists StorageErrorCode = "AccountAlreadyExists" StorageErrorCodeAccountBeingCreated StorageErrorCode = "AccountBeingCreated" StorageErrorCodeAccountIsDisabled StorageErrorCode = "AccountIsDisabled" StorageErrorCodeAppendPositionConditionNotMet StorageErrorCode = "AppendPositionConditionNotMet" StorageErrorCodeAuthenticationFailed StorageErrorCode = "AuthenticationFailed" StorageErrorCodeAuthorizationFailure StorageErrorCode = "AuthorizationFailure" StorageErrorCodeAuthorizationPermissionMismatch StorageErrorCode = "AuthorizationPermissionMismatch" StorageErrorCodeAuthorizationProtocolMismatch StorageErrorCode = "AuthorizationProtocolMismatch" StorageErrorCodeAuthorizationResourceTypeMismatch StorageErrorCode = "AuthorizationResourceTypeMismatch" StorageErrorCodeAuthorizationServiceMismatch StorageErrorCode = "AuthorizationServiceMismatch" StorageErrorCodeAuthorizationSourceIPMismatch StorageErrorCode = "AuthorizationSourceIPMismatch" StorageErrorCodeBlobAlreadyExists StorageErrorCode = "BlobAlreadyExists" StorageErrorCodeBlobArchived StorageErrorCode = "BlobArchived" StorageErrorCodeBlobBeingRehydrated StorageErrorCode = "BlobBeingRehydrated" StorageErrorCodeBlobImmutableDueToPolicy StorageErrorCode = "BlobImmutableDueToPolicy" StorageErrorCodeBlobNotArchived StorageErrorCode = "BlobNotArchived" StorageErrorCodeBlobNotFound StorageErrorCode = "BlobNotFound" StorageErrorCodeBlobOverwritten StorageErrorCode = "BlobOverwritten" StorageErrorCodeBlobTierInadequateForContentLength StorageErrorCode = "BlobTierInadequateForContentLength" StorageErrorCodeBlobUsesCustomerSpecifiedEncryption StorageErrorCode = "BlobUsesCustomerSpecifiedEncryption" StorageErrorCodeBlockCountExceedsLimit StorageErrorCode = "BlockCountExceedsLimit" StorageErrorCodeBlockListTooLong StorageErrorCode = "BlockListTooLong" StorageErrorCodeCannotChangeToLowerTier StorageErrorCode = "CannotChangeToLowerTier" StorageErrorCodeCannotVerifyCopySource StorageErrorCode = "CannotVerifyCopySource" StorageErrorCodeConditionHeadersNotSupported StorageErrorCode = "ConditionHeadersNotSupported" StorageErrorCodeConditionNotMet StorageErrorCode = "ConditionNotMet" StorageErrorCodeContainerAlreadyExists StorageErrorCode = "ContainerAlreadyExists" StorageErrorCodeContainerBeingDeleted StorageErrorCode = "ContainerBeingDeleted" StorageErrorCodeContainerDisabled StorageErrorCode = "ContainerDisabled" StorageErrorCodeContainerNotFound StorageErrorCode = "ContainerNotFound" StorageErrorCodeContentLengthLargerThanTierLimit StorageErrorCode = "ContentLengthLargerThanTierLimit" StorageErrorCodeCopyAcrossAccountsNotSupported StorageErrorCode = "CopyAcrossAccountsNotSupported" StorageErrorCodeCopyIDMismatch StorageErrorCode = "CopyIdMismatch" StorageErrorCodeEmptyMetadataKey StorageErrorCode = "EmptyMetadataKey" StorageErrorCodeFeatureVersionMismatch StorageErrorCode = "FeatureVersionMismatch" StorageErrorCodeIncrementalCopyBlobMismatch StorageErrorCode = "IncrementalCopyBlobMismatch" StorageErrorCodeIncrementalCopyOfEralierVersionSnapshotNotAllowed StorageErrorCode = "IncrementalCopyOfEralierVersionSnapshotNotAllowed" StorageErrorCodeIncrementalCopySourceMustBeSnapshot StorageErrorCode = "IncrementalCopySourceMustBeSnapshot" StorageErrorCodeInfiniteLeaseDurationRequired StorageErrorCode = "InfiniteLeaseDurationRequired" StorageErrorCodeInsufficientAccountPermissions StorageErrorCode = "InsufficientAccountPermissions" StorageErrorCodeInternalError StorageErrorCode = "InternalError" StorageErrorCodeInvalidAuthenticationInfo StorageErrorCode = "InvalidAuthenticationInfo" StorageErrorCodeInvalidBlobOrBlock StorageErrorCode = "InvalidBlobOrBlock" StorageErrorCodeInvalidBlobTier StorageErrorCode = "InvalidBlobTier" StorageErrorCodeInvalidBlobType StorageErrorCode = "InvalidBlobType" StorageErrorCodeInvalidBlockID StorageErrorCode = "InvalidBlockId" StorageErrorCodeInvalidBlockList StorageErrorCode = "InvalidBlockList" StorageErrorCodeInvalidHTTPVerb StorageErrorCode = "InvalidHttpVerb" StorageErrorCodeInvalidHeaderValue StorageErrorCode = "InvalidHeaderValue" StorageErrorCodeInvalidInput StorageErrorCode = "InvalidInput" StorageErrorCodeInvalidMD5 StorageErrorCode = "InvalidMd5" StorageErrorCodeInvalidMetadata StorageErrorCode = "InvalidMetadata" StorageErrorCodeInvalidOperation StorageErrorCode = "InvalidOperation" StorageErrorCodeInvalidPageRange StorageErrorCode = "InvalidPageRange" StorageErrorCodeInvalidQueryParameterValue StorageErrorCode = "InvalidQueryParameterValue" StorageErrorCodeInvalidRange StorageErrorCode = "InvalidRange" StorageErrorCodeInvalidResourceName StorageErrorCode = "InvalidResourceName" StorageErrorCodeInvalidSourceBlobType StorageErrorCode = "InvalidSourceBlobType" StorageErrorCodeInvalidSourceBlobURL StorageErrorCode = "InvalidSourceBlobUrl" StorageErrorCodeInvalidURI StorageErrorCode = "InvalidUri" StorageErrorCodeInvalidVersionForPageBlobOperation StorageErrorCode = "InvalidVersionForPageBlobOperation" StorageErrorCodeInvalidXMLDocument StorageErrorCode = "InvalidXmlDocument" StorageErrorCodeInvalidXMLNodeValue StorageErrorCode = "InvalidXmlNodeValue" StorageErrorCodeLeaseAlreadyBroken StorageErrorCode = "LeaseAlreadyBroken" StorageErrorCodeLeaseAlreadyPresent StorageErrorCode = "LeaseAlreadyPresent" StorageErrorCodeLeaseIDMismatchWithBlobOperation StorageErrorCode = "LeaseIdMismatchWithBlobOperation" StorageErrorCodeLeaseIDMismatchWithContainerOperation StorageErrorCode = "LeaseIdMismatchWithContainerOperation" StorageErrorCodeLeaseIDMismatchWithLeaseOperation StorageErrorCode = "LeaseIdMismatchWithLeaseOperation" StorageErrorCodeLeaseIDMissing StorageErrorCode = "LeaseIdMissing" StorageErrorCodeLeaseIsBreakingAndCannotBeAcquired StorageErrorCode = "LeaseIsBreakingAndCannotBeAcquired" StorageErrorCodeLeaseIsBreakingAndCannotBeChanged StorageErrorCode = "LeaseIsBreakingAndCannotBeChanged" StorageErrorCodeLeaseIsBrokenAndCannotBeRenewed StorageErrorCode = "LeaseIsBrokenAndCannotBeRenewed" StorageErrorCodeLeaseLost StorageErrorCode = "LeaseLost" StorageErrorCodeLeaseNotPresentWithBlobOperation StorageErrorCode = "LeaseNotPresentWithBlobOperation" StorageErrorCodeLeaseNotPresentWithContainerOperation StorageErrorCode = "LeaseNotPresentWithContainerOperation" StorageErrorCodeLeaseNotPresentWithLeaseOperation StorageErrorCode = "LeaseNotPresentWithLeaseOperation" StorageErrorCodeMD5Mismatch StorageErrorCode = "Md5Mismatch" StorageErrorCodeMaxBlobSizeConditionNotMet StorageErrorCode = "MaxBlobSizeConditionNotMet" StorageErrorCodeMetadataTooLarge StorageErrorCode = "MetadataTooLarge" StorageErrorCodeMissingContentLengthHeader StorageErrorCode = "MissingContentLengthHeader" StorageErrorCodeMissingRequiredHeader StorageErrorCode = "MissingRequiredHeader" StorageErrorCodeMissingRequiredQueryParameter StorageErrorCode = "MissingRequiredQueryParameter" StorageErrorCodeMissingRequiredXMLNode StorageErrorCode = "MissingRequiredXmlNode" StorageErrorCodeMultipleConditionHeadersNotSupported StorageErrorCode = "MultipleConditionHeadersNotSupported" StorageErrorCodeNoAuthenticationInformation StorageErrorCode = "NoAuthenticationInformation" StorageErrorCodeNoPendingCopyOperation StorageErrorCode = "NoPendingCopyOperation" StorageErrorCodeOperationNotAllowedOnIncrementalCopyBlob StorageErrorCode = "OperationNotAllowedOnIncrementalCopyBlob" StorageErrorCodeOperationTimedOut StorageErrorCode = "OperationTimedOut" StorageErrorCodeOutOfRangeInput StorageErrorCode = "OutOfRangeInput" StorageErrorCodeOutOfRangeQueryParameterValue StorageErrorCode = "OutOfRangeQueryParameterValue" StorageErrorCodePendingCopyOperation StorageErrorCode = "PendingCopyOperation" StorageErrorCodePreviousSnapshotCannotBeNewer StorageErrorCode = "PreviousSnapshotCannotBeNewer" StorageErrorCodePreviousSnapshotNotFound StorageErrorCode = "PreviousSnapshotNotFound" StorageErrorCodePreviousSnapshotOperationNotSupported StorageErrorCode = "PreviousSnapshotOperationNotSupported" StorageErrorCodeRequestBodyTooLarge StorageErrorCode = "RequestBodyTooLarge" StorageErrorCodeRequestURLFailedToParse StorageErrorCode = "RequestUrlFailedToParse" StorageErrorCodeResourceAlreadyExists StorageErrorCode = "ResourceAlreadyExists" StorageErrorCodeResourceNotFound StorageErrorCode = "ResourceNotFound" StorageErrorCodeResourceTypeMismatch StorageErrorCode = "ResourceTypeMismatch" StorageErrorCodeSequenceNumberConditionNotMet StorageErrorCode = "SequenceNumberConditionNotMet" StorageErrorCodeSequenceNumberIncrementTooLarge StorageErrorCode = "SequenceNumberIncrementTooLarge" StorageErrorCodeServerBusy StorageErrorCode = "ServerBusy" StorageErrorCodeSnaphotOperationRateExceeded StorageErrorCode = "SnaphotOperationRateExceeded" StorageErrorCodeSnapshotCountExceeded StorageErrorCode = "SnapshotCountExceeded" StorageErrorCodeSnapshotsPresent StorageErrorCode = "SnapshotsPresent" StorageErrorCodeSourceConditionNotMet StorageErrorCode = "SourceConditionNotMet" StorageErrorCodeSystemInUse StorageErrorCode = "SystemInUse" StorageErrorCodeTargetConditionNotMet StorageErrorCode = "TargetConditionNotMet" StorageErrorCode = "UnauthorizedBlobOverwrite" StorageErrorCodeUnsupportedHTTPVerb StorageErrorCode = "UnsupportedHttpVerb" StorageErrorCodeUnsupportedHeader StorageErrorCode = "UnsupportedHeader" StorageErrorCodeUnsupportedQueryParameter StorageErrorCode = "UnsupportedQueryParameter" StorageErrorCodeUnsupportedXMLNode StorageErrorCode = "UnsupportedXmlNode" )
func PossibleStorageErrorCodeValues ¶
func PossibleStorageErrorCodeValues() []StorageErrorCode
PossibleStorageErrorCodeValues returns the possible values for the StorageErrorCode const type.
func (StorageErrorCode) ToPtr ¶
func (c StorageErrorCode) ToPtr() *StorageErrorCode
ToPtr returns a *StorageErrorCode pointing to the current value.
type StorageServiceProperties ¶
type StorageServiceProperties struct { // The set of CORS rules. Cors []*CorsRule `xml:"Cors>CorsRule"` // The default version to use for requests to the Blob service if an incoming request's version is not specified. Possible values include version 2008-10-27 // and all more recent versions DefaultServiceVersion *string `xml:"DefaultServiceVersion"` // the retention policy which determines how long the associated data should persist DeleteRetentionPolicy *RetentionPolicy `xml:"DeleteRetentionPolicy"` // a summary of request statistics grouped by API in hour or minute aggregates for blobs HourMetrics *Metrics `xml:"HourMetrics"` // Azure Analytics Logging settings. Logging *Logging `xml:"Logging"` // a summary of request statistics grouped by API in hour or minute aggregates for blobs MinuteMetrics *Metrics `xml:"MinuteMetrics"` // The properties that enable an account to host a static website StaticWebsite *StaticWebsite `xml:"StaticWebsite"` }
StorageServiceProperties - Storage Service Properties.
func (StorageServiceProperties) MarshalXML ¶
func (s StorageServiceProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaller interface for type StorageServiceProperties.
type StorageServiceStats ¶
type StorageServiceStats struct { // Geo-Replication information for the Secondary Storage Service GeoReplication *GeoReplication `xml:"GeoReplication"` }
StorageServiceStats - Stats for the storage service.
type TransferManager ¶
type TransferManager interface { // Get provides a buffer that will be used to read data into and write out to the stream. // It is guaranteed by this package to not read or write beyond the size of the slice. Get() []byte // Put may or may not put the buffer into underlying storage, depending on settings. // The buffer must not be touched after this has been called. Put(b []byte) // nolint // Run will use a goroutine pool entry to run a function. This blocks until a pool // goroutine becomes available. Run(func()) // Close shuts down all internal goroutines. This must be called when the TransferManager // will no longer be used. Not closing it will cause a goroutine leak. Close() }
TransferManager provides a buffer and thread pool manager for certain transfer options. It is undefined behavior if code outside of this package call any of these methods.
func NewStaticBuffer ¶
func NewStaticBuffer(size, max int) (TransferManager, error)
NewStaticBuffer creates a TransferManager that will use a channel as a circular buffer that can hold "max" buffers of "size". The goroutine pool is also sized at max. This can be shared between calls if you wish to control maximum memory and concurrency with multiple concurrent calls.
func NewSyncPool ¶
func NewSyncPool(size, concurrency int) (TransferManager, error)
NewSyncPool creates a TransferManager that will use a sync.Pool that can hold a non-capped number of buffers constrained by concurrency. This can be shared between calls if you wish to share memory and concurrency.
type UpdateSequenceNumberPageBlob ¶
type UpdateSequenceNumberPageBlob struct { ActionType *SequenceNumberActionType BlobSequenceNumber *int64 BlobAccessConditions *BlobAccessConditions }
type UploadBlockBlobOptions ¶
type UploadBlockBlobOptions struct { // Optional. Used to set blob tags in various blob operations. TagsMap map[string]string // Optional. Specifies a user-defined name-value pair associated with the blob. Metadata map[string]string // Optional. Indicates the tier to be set on the blob. Tier *AccessTier // Specify the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 []byte HTTPHeaders *BlobHTTPHeaders CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo BlobAccessConditions *BlobAccessConditions }
type UploadPagesFromURLOptions ¶
type UploadPagesFromURLOptions struct { // Specify the md5 calculated for the range of bytes that must be read from the copy source. SourceContentMD5 []byte // Specify the crc64 calculated for the range of bytes that must be read from the copy source. SourceContentcrc64 []byte CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo SequenceNumberAccessConditions *SequenceNumberAccessConditions SourceModifiedAccessConditions *SourceModifiedAccessConditions BlobAccessConditions *BlobAccessConditions }
type UploadPagesOptions ¶
type UploadPagesOptions struct { // Specify the transactional crc64 for the body, to be validated by the service. PageRange *HttpRange TransactionalContentCRC64 []byte // Specify the transactional md5 for the body, to be validated by the service. TransactionalContentMD5 []byte CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo SequenceNumberAccessConditions *SequenceNumberAccessConditions BlobAccessConditions *BlobAccessConditions }
type UploadStreamToBlockBlobOptions ¶
type UploadStreamToBlockBlobOptions struct { // TransferManager provides a TransferManager that controls buffer allocation/reuse and // concurrency. This overrides BufferSize and MaxBuffers if set. TransferManager TransferManager // BufferSize sizes the buffer used to read data from source. If < 1 MiB, defaults to 1 MiB. BufferSize int // MaxBuffers defines the number of simultaneous uploads will be performed to upload the file. MaxBuffers int HTTPHeaders *BlobHTTPHeaders Metadata map[string]string BlobAccessConditions *BlobAccessConditions AccessTier *AccessTier BlobTagsMap map[string]string CpkInfo *CpkInfo CpkScopeInfo *CpkScopeInfo // contains filtered or unexported fields }
type UserDelegationKey ¶
type UserDelegationKey struct { // REQUIRED; The date-time the key expires SignedExpiry *time.Time `xml:"SignedExpiry"` // REQUIRED; The Azure Active Directory object ID in GUID format. SignedOid *string `xml:"SignedOid"` // REQUIRED; Abbreviation of the Azure Storage service that accepts the key SignedService *string `xml:"SignedService"` // REQUIRED; The date-time the key is active SignedStart *time.Time `xml:"SignedStart"` // REQUIRED; The Azure Active Directory tenant ID in GUID format SignedTid *string `xml:"SignedTid"` // REQUIRED; The service version that created the key SignedVersion *string `xml:"SignedVersion"` // REQUIRED; The key as a base64 string Value *string `xml:"Value"` }
UserDelegationKey - A user delegation key
func (UserDelegationKey) MarshalXML ¶
func (u UserDelegationKey) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaller interface for type UserDelegationKey.
func (*UserDelegationKey) UnmarshalXML ¶
func (u *UserDelegationKey) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaller interface for type UserDelegationKey.
Source Files ¶
bytes_writer.go chunkwriting.go constants.go doc.go highlevel.go section_writer.go version.go zc_access_policy.go zc_append_blob_client.go zc_blob_client.go zc_blob_lease_client.go zc_block_blob_client.go zc_connection_string.go zc_container_client.go zc_container_lease_client.go zc_page_blob_client.go zc_parsing_urls.go zc_response_error.go zc_response_helpers.go zc_retry_reader.go zc_sas_account.go zc_sas_query_params.go zc_sas_service.go zc_service_client.go zc_shared_policy_shared_key_credential.go zc_storage_error.go zc_validators.go zm_access_conditions.go zm_append_blob_request_options.go zm_blob_request_options.go zm_block_blob_request_options.go zm_client_options.go zm_container_request_options.go zm_lease_request_options.go zm_page_blob_request_options.go zm_service_request_options.go zu_serialize_and_desearilize.go zz_generated_appendblob_client.go zz_generated_blob_client.go zz_generated_blockblob_client.go zz_generated_connection.go zz_generated_constants.go zz_generated_container_client.go zz_generated_directory_client.go zz_generated_models.go zz_generated_pageblob_client.go zz_generated_pagers.go zz_generated_response_types.go zz_generated_service_client.go zz_generated_time_rfc1123.go zz_generated_time_rfc3339.go zz_generated_xml_helper.go
Directories ¶
Path | Synopsis |
---|---|
internal |
- Version
- v0.1.0
- Published
- Sep 13, 2021
- Platform
- darwin/amd64
- Imports
- 30 packages
- Last checked
- now –
Tools for package owners.