azblob

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 30 Imported by: 309

README

Azure Blob Storage SDK for Go

Introduction

The Microsoft Azure Storage SDK for Go allows you to build applications that takes advantage of Azure's scalable cloud storage. This is the new beta client module for Azure Blob Storage, which follows our Azure SDK Design Guidelines for Go and replaces the previous beta azblob package.

Getting Started

The Azure Blob SDK can access an Azure Storage account.

Prerequisites
  • Go versions 1.16 or higher

  • You must have an Azure storage account. If you need to create one, you can use the Azure Cloud Shell to create one with these commands (replace my-resource-group and mystorageaccount with your own unique names): (Optional) if you want a new resource group to hold the Storage Account:

    az group create --name my-resource-group --location westus2
    

    Create the storage account:

    az storage account create --resource-group my-resource-group --name mystorageaccount
    

    The storage account name can be queried with:

    az storage account show -n mystorageaccount -g my-resource-group --query "primaryEndpoints.blob"
    

    You can set this as an environment variable with:

    # PowerShell
    $ENV:AZURE_STORAGE_ACCOUNT_NAME="mystorageaccount"
    # bash
    export AZURE_STORAGE_ACCOUNT_NAME="mystorageaccount"
    

    Query your storage account keys:

    az storage account keys list --resource-group my-resource-group -n mystorageaccount
    

    Output:

    [
    	{
    		"creationTime": "2022-02-07T17:18:44.088870+00:00",
    		"keyName": "key1",
    		"permissions": "FULL",
    		"value": "..."
    	},
    	{
    		"creationTime": "2022-02-07T17:18:44.088870+00:00",
    		"keyName": "key2",
    		"permissions": "FULL",
    		"value": "..."
    	}
    ]
    
    # PowerShell
    $ENV:AZURE_STORAGE_ACCOUNT_KEY="<mystorageaccountkey>"
    # Bash
    export AZURE_STORAGE_ACCOUNT_KEY="<mystorageaccountkey>"
    

    You can obtain your account key from the Azure Portal under the "Access Keys" section on the left-hand pane of your storage account.

Create account
Install the package
  • Install the Azure Blob Storage client module for Go with go get:
go get github.com/Azure/azure-sdk-for-go/sdk/storage/azblob

Optional: If you are going to use AAD authentication, install the azidentity package:

go get github.com/Azure/azure-sdk-for-go/sdk/azidentity
Create the client

azblob allows you to interact with three types of resources :-

Interaction with these resources starts with an instance of a client. To create a client object, you will need the account's blob service endpoint URL and a credential that allows you to access the account. The endpoint can be found on the page for your storage account in the Azure Portal under the "Access Keys" section or by running the following Azure CLI command:

# Get the blob service URL for the account
az storage account show -n mystorageaccount -g my-resource-group --query "primaryEndpoints.blob"

Once you have the account URL, it can be used to create the service client:

cred, err := azblob.NewSharedKeyCredential("myAccountName", "myAccountKey")
handle(err)
serviceClient, err := azblob.NewServiceClientWithSharedKey("https://<myAccountName>.blob.core.windows.net/", cred, nil)
handle(err)

For more information about blob service URL's and how to configure custom domain names for Azure Storage check out the official documentation

Types of credentials

The azblob clients support authentication via Shared Key Credential, Connection String, Shared Access Signature, or any of the azidentity types that implement the azcore.TokenCredential interface.

1. Creating the client from a shared key

To use an account shared key (aka account key or access key), provide the key as a string. This can be found in your storage account in the Azure Portal under the "Access Keys" section or by running the following Azure CLI command:

az storage account keys list -g my-resource-group -n mystorageaccount

Use Shared Key authentication as the credential parameter to authenticate the client:

credential, err := azblob.NewSharedKeyCredential("accountName", "accountKey")
handle(err)
serviceClient, err := azblob.NewServiceClientWithSharedKey("https://<myAccountName>.blob.core.windows.net/", credential, nil)
handle(err)
2. Creating the client from a connection string

You can use connection string, instead of providing the account URL and credential separately, for authentication as well. To do this, pass the connection string to the client's NewServiceClientFromConnectionString method. The connection string can be found in your storage account in the Azure Portal under the "Access Keys" section or with the following Azure CLI command:

az storage account show-connection-string -g my-resource-group -n mystorageaccount
connStr := "DefaultEndpointsProtocol=https;AccountName=<myAccountName>;AccountKey=<myAccountKey>;EndpointSuffix=core.windows.net"
serviceClient, err := azblob.NewServiceClientFromConnectionString(connStr, nil)
3. Creating the client from a SAS token

To use a shared access signature (SAS) token, provide the token as a string. You can generate a SAS token from the Azure Portal under Shared access signature or use the ServiceClient.GetSASToken or ContainerClient.GetSASToken() methods.

credential, err := azblob.NewSharedKeyCredential("accountName", "accountKey")
handle(err)
serviceClient, err := azblob.NewServiceClientWithSharedKey(fmt.Sprintf("https://%s.blob.core.windows.net/", accountName), credential, nil)
handle(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))
handle(err)
sasURL := fmt.Sprintf("https://%s.blob.core.windows.net/?%s", accountName, accountSAS)

// The sasURL can be used to authenticate a client without need for a credential
serviceClient, err = NewServiceClientWithNoCredential(sasURL, nil)
handle(err)
Clients

Three different clients are provided to interact with the various components of the Blob Service:

  1. ServiceClient

    • Get and set account settings.
    • Query, create, and delete containers within the account.
  2. ContainerClient

    • Get and set container access settings, properties, and metadata.
    • Create, delete, and query blobs within the container.
    • ContainerLeaseClient to support container lease management.
  3. BlobClient

    • AppendBlobClient, BlockBlobClient, and PageBlobClient
    • Get and set blob properties.
    • Perform CRUD operations on a given blob.
    • BlobLeaseClient to support blob lease management.
Example
	// 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 {
		handle(errors.New("AZURE_STORAGE_ACCOUNT_NAME could not be found"))
	}

	accountKey, ok := os.LookupEnv("AZURE_STORAGE_ACCOUNT_KEY")
	if !ok {
		handle(errors.New("AZURE_STORAGE_ACCOUNT_KEY could not be found"))
	}
	cred, err := NewSharedKeyCredential(accountName, accountKey)
    handle(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 := NewServiceClientWithSharedKey(fmt.Sprintf("https://%s.blob.core.windows.net/", accountName), cred, nil)
    handle(err)

	// All operations in the Azure Blob Storage 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)
    handle(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)
    handle(err)

	// Download the blob's contents and ensure that the download worked properly
	get, err := blockBlob.Download(ctx, nil)
    handle(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)
    handle(err)
	err = reader.Close()
    handle(err)
	if data != downloadedData.String() {
		handle(errors.New("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 {
		handle(err)
	}

	// Delete the blob we created earlier.
	_, err = blockBlob.Delete(ctx, nil)
	handle(err)

	// Delete the container we created earlier.
	_, err = container.Delete(ctx, nil)
	handle(err)

Troubleshooting

Error Handling

All I/O operations will return an error that can be investigated to discover more information about the error. In addition, you can investigate the raw response of any response object:

var errResp azcore.HTTPResponse
resp, err := serviceClient.CreateContainer(context.Background(), "testcontainername", nil)
if err != nil {
   if errors.As(err, &errResp) {
        // do something with errResp.RawResponse()
   }
}
Logging

This module uses the classification based logging implementation in azcore. To turn on logging set AZURE_SDK_GO_LOGGING to all.

If you only want to include logs for azblob, you must create your own logger and set the log classification as LogCredential.

To obtain more detailed logging, including request/response bodies and header values, make sure to leave the logger as default or enable the LogRequest and/or LogResponse classificatons. A logger that only includes credential logs can be like the following:

import azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log"
// Set log to output to the console
azlog.SetListener(func(cls azlog.Classification, msg string) {
	fmt.Println(msg) // printing log out to the console
})

// Includes only requests and responses in credential logs
azlog.SetClassifications(azlog.Request, azlog.Response)

CAUTION: logs from credentials contain sensitive information. These logs must be protected to avoid compromising account security.

License

This project is licensed under MIT.

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the Azure.AzBlob label.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Overview

Example

This example shows you how to get started using the Azure Blob Storage SDK for Go.

package main

import (
	"bytes"
	"context"
	"fmt"
	"log"
	"os"
	"strings"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	// Your account name and key can be obtained 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 := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}

	// The service URL for blob endpoints is usually in the form: http(s)://<account>.blob.core.windows.net/
	service, err := azblob.NewServiceClientWithSharedKey(fmt.Sprintf("https://%s.blob.core.windows.net/", accountName), cred, nil)
	if err != nil {
		log.Fatal(err)
	}

	// ===== 1. Create a container =====

	// First, create a container client, and use the Create method to create a new container in your account
	container := service.NewContainerClient("mycontainer")
	// All functions that make service requests have an options struct as the final parameter.
	// The options struct allows you to specify optional parameters such as metadata, public access types, etc.
	// If you want to use the default options, pass in nil.
	_, err = container.Create(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}

	// ===== 2. Upload and Download a block blob =====
	data := "Hello world!"

	// Create a new BlockBlobClient from the ContainerClient
	blockBlob := container.NewBlockBlobClient("HelloWorld.txt")

	// Upload data to the block blob
	_, err = blockBlob.Upload(context.TODO(), streaming.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(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}

	// Use the bytes.Buffer object to read the downloaded data.
	downloadedData := &bytes.Buffer{}
	reader := get.Body(nil) // 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 does not match uploaded data")
	} else {
		fmt.Printf("Downloaded data: %s\n", downloadedData.String())
	}

	// ===== 3. List blobs =====
	// List methods returns a pager object which can be used to iterate over the results of a paging operation.
	// To iterate over a page use the NextPage(context.Context) to fetch the next page of results.
	// PageResponse() can be used to iterate over the results of the specific page.
	// Always check the Err() method after paging to see if an error was returned by the pager. A pager will return either an error or the page of results.
	pager := container.ListBlobsFlat(nil)
	for pager.NextPage(context.TODO()) {
		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.
	_, err = blockBlob.Delete(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}

	// Delete the container.
	_, err = container.Delete(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}
}
Output:

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 delete blob snapshots.

package main

import (
	"bytes"
	"context"
	"fmt"
	"log"
	"os"
	"strings"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer", accountName)
	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}
	containerClient, err := azblob.NewContainerClientWithSharedKey(u, credential, nil)
	if err != nil {
		log.Fatal(err)
	}

	// Create a BlockBlobClient object to a blob in the container.
	baseBlobClient := containerClient.NewBlockBlobClient("Original.txt")

	// Create the original blob:
	_, err = baseBlobClient.Upload(context.TODO(), streaming.NopCloser(streaming.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(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}
	snapshot := *createSnapshot.Snapshot

	// Modify the original blob:
	_, err = baseBlobClient.Upload(context.TODO(), streaming.NopCloser(strings.NewReader("New text")), nil)
	if err != nil {
		log.Fatal(err)
	}

	// Download the modified blob:
	get, err := baseBlobClient.Download(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}
	b := bytes.Buffer{}
	reader := get.Body(nil)
	_, err = b.ReadFrom(reader)
	if err != nil {
		return
	}
	err = reader.Close()
	if err != nil {
		return
	}
	fmt.Println(b.String())

	// Show snapshot blob via original blob URI & snapshot time:
	snapshotBlobClient := baseBlobClient.WithSnapshot(snapshot)
	get, err = snapshotBlobClient.Download(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}
	b.Reset()
	reader = get.Body(nil)
	_, err = b.ReadFrom(reader)
	if err != nil {
		return
	}
	err = reader.Close()
	if err != nil {
		return
	}
	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(context.TODO()) {
		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(context.TODO(), 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(context.TODO(), &azblob.DeleteBlobOptions{DeleteSnapshots: azblob.DeleteSnapshotsOptionTypeInclude.ToPtr()})
	if err != nil {
		log.Fatal(err)
	}
}
Output:

Example (ProgressUploadDownload)
package main

import (
	"bytes"
	"context"
	"fmt"
	"log"
	"os"
	"strings"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	// Create a credentials object with your Azure Storage Account name and key.
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")
	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}

	// From the Azure portal, get your Storage account blob service URL endpoint.
	containerURL := 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 := azblob.NewContainerClientWithSharedKey(containerURL, credential, nil)
	if err != nil {
		log.Fatal(err)
	}

	// 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 := streaming.NopCloser(strings.NewReader("Some text to write"))

	// Wrap the request body in a RequestBodyProgress and pass a callback function for progress reporting.
	requestProgress := streaming.NewRequestProgress(streaming.NopCloser(requestBody), func(bytesTransferred int64) {
		fmt.Printf("Wrote %d of %d bytes.", bytesTransferred, requestBody)
	})
	_, err = blobClient.Upload(context.TODO(), requestProgress, &azblob.UploadBlockBlobOptions{
		HTTPHeaders: &azblob.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(context.TODO(), 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(nil),
		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
	}
	fmt.Printf("Downloaded data: %s\n", downloadedData.String())
}
Output:

Index

Examples

Constants

View Source
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
)
View Source
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

View Source
const (
	// ETagNone represents an empty entity tag.
	ETagNone = ""

	// ETagAny matches any entity tag.
	ETagAny = "*"
)
View Source
const BlobDefaultDownloadBlockSize = int64(4 * 1024 * 1024) // 4MB
View Source
const CountToEnd = 0
View Source
const LeaseBreakNaturally = -1

LeaseBreakNaturally tells ContainerClient's or BlobClient's BreakLease method to break the lease using service semantics.

View Source
const (
	// PageBlobPageBytes indicates the number of bytes in a page (512).
	PageBlobPageBytes = 512
)
View Source
const ReadOnClosedBodyMessage = "read on closed response body"
View Source
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.

View Source
const (
	SASVersion = "2019-12-12"
)

nolint

View Source
const (
	SnapshotTimeFormat = "2006-01-02T15:04:05.0000000Z07:00"
)

Variables

View Source
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, Tag, FilterByTags 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

Sign uses an account's shared key credential to sign this signature values to produce the proper SAS query parameters.

Example

This example shows how to create and use an Azure Storage account Shared Access Signature (SAS).

package main

import (
	"fmt"
	"log"
	"os"
	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}

	sasQueryParams, err := azblob.AccountSASSignatureValues{
		Protocol:      azblob.SASProtocolHTTPS,
		ExpiryTime:    time.Now().UTC().Add(48 * time.Hour),
		Permissions:   azblob.AccountSASPermissions{Read: true, List: true}.String(),
		Services:      azblob.AccountSASServices{Blob: true}.String(),
		ResourceTypes: azblob.AccountSASResourceTypes{Container: true, Object: true}.String(),
	}.Sign(credential)
	if err != nil {
		log.Fatal(err)
	}

	queryParams := sasQueryParams.Encode()
	sasURL := fmt.Sprintf("https://%s.blob.core.windows.net/?%s", accountName, queryParams)

	// This URL can be used to authenticate requests now
	serviceClient, err := azblob.NewServiceClientWithNoCredential(sasURL, nil)
	if err != nil {
		log.Fatal(err)
	}

	// You can also break a blob URL up into it's constituent parts
	blobURLParts := azblob.NewBlobURLParts(serviceClient.URL())
	fmt.Printf("SAS expiry time = %s\n", blobURLParts.SAS.ExpiryTime())
}
Output:

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. The maximum size of an append blob is slightly more than 4.75 TB (100 MB X 50,000 blocks).

package main

import (
	"bytes"
	"context"
	"fmt"
	"log"
	"os"
	"strings"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/MyAppendBlob.txt", accountName)
	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}
	appendBlobClient, err := azblob.NewAppendBlobClientWithSharedKey(u, credential, nil)
	if err != nil {
		log.Fatal(err)
	}

	_, err = appendBlobClient.Create(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}

	for i := 0; i < 5; i++ { // Append 5 blocks to the append blob
		_, err := appendBlobClient.AppendBlock(context.TODO(), streaming.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 read into a bytes.Buffer.
	get, err := appendBlobClient.Download(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}
	b := bytes.Buffer{}
	reader := get.Body(nil)
	_, err = b.ReadFrom(reader)
	if err != nil {
		return
	}
	err = reader.Close()
	if err != nil {
		return
	}
	fmt.Println(b.String())
}
Output:

func NewAppendBlobClient

func NewAppendBlobClient(blobURL string, cred azcore.TokenCredential, options *ClientOptions) (AppendBlobClient, error)

NewAppendBlobClient creates an AppendBlobClient with the specified URL, Azure AD credential, and options.

func NewAppendBlobClientWithNoCredential added in v0.2.0

func NewAppendBlobClientWithNoCredential(blobURL string, options *ClientOptions) (AppendBlobClient, error)

NewAppendBlobClientWithNoCredential creates an AppendBlobClient with the specified URL and options.

func NewAppendBlobClientWithSharedKey added in v0.2.0

func NewAppendBlobClientWithSharedKey(blobURL string, cred *SharedKeyCredential, options *ClientOptions) (AppendBlobClient, error)

NewAppendBlobClientWithSharedKey creates an AppendBlobClient with the specified URL, shared key, and options.

func (AppendBlobClient) AppendBlock

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

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

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

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.

Example

This example shows how to perform operations on blob conditionally.

package main

import (
	"context"
	"errors"
	"fmt"
	"log"
	"os"
	"strings"
	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}
	blockBlob, err := azblob.NewBlockBlobClientWithSharedKey(fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/Data.txt", accountName), credential, nil)
	if err != nil {
		log.Fatal(err)
	}

	// This function displays the results of an operation
	showResult := func(response *azblob.DownloadResponse, err error) {
		if err != nil {
			var stgErr *azblob.StorageError
			if errors.As(err, &stgErr) {
				log.Fatalf("Failure: %s\n", stgErr.Error())
			} else {
				log.Fatal(err) // Network failure
			}
		} else {
			err := response.Body(nil).Close()
			if err != nil {
				log.Fatal(err)
			}
			// The client must close the response body when finished with it
			fmt.Printf("Success: %s\n", response.RawResponse.Status)
		}

		// Close the response
		if err != nil {
			return
		}
		fmt.Printf("Success: %s\n", response.RawResponse.Status)
	}

	showResultUpload := func(upload azblob.BlockBlobUploadResponse, err error) {
		if err != nil {
			var stgErr *azblob.StorageError
			if errors.As(err, &stgErr) {
				log.Fatalf("Failure: " + stgErr.Error() + "\n")
			} else {
				log.Fatal(err) // Network failure
			}
		}
		fmt.Print("Success: " + upload.RawResponse.Status + "\n")
	}

	// Create the blob
	upload, err := blockBlob.Upload(context.TODO(), streaming.NopCloser(strings.NewReader("Text-1")), nil)
	showResultUpload(upload, err)

	// Download blob content if the blob has been modified since we uploaded it (fails):
	showResult(blockBlob.Download(
		context.TODO(),
		&azblob.DownloadBlobOptions{
			BlobAccessConditions: &azblob.BlobAccessConditions{
				ModifiedAccessConditions: &azblob.ModifiedAccessConditions{
					IfModifiedSince: upload.LastModified,
				},
			},
		},
	))

	// Download blob content if the blob hasn't been modified in the last 24 hours (fails):
	showResult(blockBlob.Download(
		context.TODO(),
		&azblob.DownloadBlobOptions{
			BlobAccessConditions: &azblob.BlobAccessConditions{
				ModifiedAccessConditions: &azblob.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):
	showResultUpload(blockBlob.Upload(
		context.TODO(),
		streaming.NopCloser(strings.NewReader("Text-2")),
		&azblob.UploadBlockBlobOptions{
			BlobAccessConditions: &azblob.BlobAccessConditions{
				ModifiedAccessConditions: &azblob.ModifiedAccessConditions{IfMatch: upload.ETag},
			},
		},
	))

	// Download content if it has changed since the version identified by ETag (fails):
	showResult(blockBlob.Download(
		context.TODO(),
		&azblob.DownloadBlobOptions{
			BlobAccessConditions: &azblob.BlobAccessConditions{
				ModifiedAccessConditions: &azblob.ModifiedAccessConditions{IfNoneMatch: upload.ETag}},
		}))

	// Upload content if the blob doesn't already exist (fails):
	showResultUpload(blockBlob.Upload(
		context.TODO(),
		streaming.NopCloser(strings.NewReader("Text-3")),
		&azblob.UploadBlockBlobOptions{
			BlobAccessConditions: &azblob.BlobAccessConditions{
				ModifiedAccessConditions: &azblob.ModifiedAccessConditions{IfNoneMatch: to.StringPtr(string(azcore.ETagAny))},
			},
		}))
}
Output:

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.

Example (StartCopy)

This example shows how to copy a source document on the Internet to a blob.

package main

import (
	"context"
	"fmt"
	"log"
	"os"
	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	// 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.
	blobURL := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/CopiedBlob.bin", accountName)
	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}
	blobClient, err := azblob.NewBlobClientWithSharedKey(blobURL, credential, nil)
	if err != nil {
		log.Fatal(err)
	}

	src := "https://cdn2.auth0.com/docs/media/addons/azure_blob.svg"
	startCopy, err := blobClient.StartCopyFromURL(context.TODO(), src, nil)
	if err != nil {
		log.Fatal(err)
	}

	copyID := *startCopy.CopyID
	copyStatus := *startCopy.CopyStatus
	for copyStatus == azblob.CopyStatusTypePending {
		time.Sleep(time.Second * 2)
		getMetadata, err := blobClient.GetProperties(context.TODO(), 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)
}
Output:

func NewBlobClient

func NewBlobClient(blobURL string, cred azcore.TokenCredential, options *ClientOptions) (BlobClient, error)

NewBlobClient creates a BlobClient object using the specified URL, Azure AD credential, and options.

func NewBlobClientFromConnectionString

func NewBlobClientFromConnectionString(connectionString, containerName, blobName string, options *ClientOptions) (BlobClient, error)

NewBlobClientFromConnectionString creates BlobClient from a Connection String nolint

func NewBlobClientWithNoCredential added in v0.2.0

func NewBlobClientWithNoCredential(blobURL string, options *ClientOptions) (BlobClient, error)

NewBlobClientWithNoCredential creates a BlobClient object using the specified URL and options.

func NewBlobClientWithSharedKey added in v0.2.0

func NewBlobClientWithSharedKey(blobURL string, cred *SharedKeyCredential, options *ClientOptions) (BlobClient, error)

NewBlobClientWithSharedKey creates a BlobClient object using the specified URL, shared key, and options.

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

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

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.

Example

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.

package main

import (
	"context"
	"fmt"
	"io"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	// From the Azure portal, get your Storage account blob service URL endpoint.
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	// Create a BlobClient object to a blob in the container (we assume the container & blob already exist).
	blobURL := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/BigBlob.bin", accountName)
	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}
	blobClient, err := azblob.NewBlobClientWithSharedKey(blobURL, 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(nil)

	// 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 {
			log.Fatal(err)
		}
	}(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)
	}
	fmt.Printf("Wrote %d bytes.\n", written)
}
Output:

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) DownloadBlobToWriterAt added in v0.3.0

func (b BlobClient) DownloadBlobToWriterAt(ctx context.Context, offset int64, count int64, writer io.WriterAt, o HighLevelDownloadFromBlobOptions) error

DownloadBlobToWriterAt downloads an Azure blob to a WriterAt with parallel. Offset and count are optional, pass 0 for both to download the entire blob.

func (BlobClient) GetProperties

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 credential supplied during creation was a SharedKeyCredential.

func (BlobClient) GetTags

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.

Example

This example shows how to create a blob with metadata, read blob metadata, and update a blob's read-only properties and metadata.

package main

import (
	"context"
	"fmt"
	"log"
	"os"
	"strings"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	// Create a blob client
	u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/ReadMe.txt", accountName)
	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}
	blobClient, err := azblob.NewBlockBlobClientWithSharedKey(u, credential, nil)
	if err != nil {
		log.Fatal(err)
	}

	// Create a blob with metadata (string key/value pairs)
	// Metadata key names are always converted to lowercase before being sent to the Storage Service.
	// Always use lowercase letters; especially when querying a map for a metadata key.
	creatingApp, err := os.Executable()
	if err != nil {
		log.Fatal(err)
	}
	_, err = blobClient.Upload(
		context.TODO(),
		streaming.NopCloser(strings.NewReader("Some text")),
		&azblob.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(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}

	// Show some of the blob's read-only properties
	fmt.Printf("BlobType: %s\nETag: %s\nLastModified: %s\n", *get.BlobType, *get.ETag, *get.LastModified)

	// Show the blob's metadata
	if get.Metadata == nil {
		log.Fatal("No metadata returned")
	}

	for k, v := range get.Metadata {
		fmt.Print(k + "=" + v + "\n")
	}

	// Update the blob's metadata and write it back to the blob
	get.Metadata["editor"] = "Grant"
	_, err = blobClient.SetMetadata(context.TODO(), get.Metadata, nil)
	if err != nil {
		log.Fatal(err)
	}
}
Output:

func (BlobClient) SetTags

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

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

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.

Example

This examples shows how to create a blob with HTTP Headers, how to read, and how to update the blob's HTTP headers.

package main

import (
	"context"
	"fmt"
	"log"
	"os"
	"strings"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	// Create a blob client
	u := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/ReadMe.txt", accountName)
	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}
	blobClient, err := azblob.NewBlockBlobClientWithSharedKey(u, credential, nil)
	if err != nil {
		log.Fatal(err)
	}

	// Create a blob with HTTP headers
	_, err = blobClient.Upload(
		context.TODO(),
		streaming.NopCloser(strings.NewReader("Some text")),
		&azblob.UploadBlockBlobOptions{HTTPHeaders: &azblob.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(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}

	// Show some of the blob's read-only properties
	fmt.Printf("BlobType: %s\nETag: %s\nLastModified: %s\n", *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(context.TODO(), httpHeaders, nil)
	if err != nil {
		log.Fatal(err)
	}
}
Output:

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         map[string]*string `xml:"Metadata"`

	// Dictionary of
	ObjectReplicationMetadata map[string]*string `xml:"OrMetadata"`
	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

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

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

ChangeLease changes the blob's lease ID. For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob.

func (*BlobLeaseClient) ReleaseLease

ReleaseLease releases the blob's previously-acquired lease. For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob.

func (*BlobLeaseClient) RenewLease

RenewLease renews the blob's previously-acquired lease. For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob.

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:"IsSealed"`
	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, Tag, List, Move, Execute, Ownership, Permissions 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
	Directory                  string // Not nil for a directory SAS (ie sr=d)
	CacheControl               string // rscc
	ContentDisposition         string // rscd
	ContentEncoding            string // rsce
	ContentLanguage            string // rscl
	ContentType                string // rsct
	BlobVersion                string // sr=bv
	PreauthorizedAgentObjectId string
	AgentObjectId              string
	CorrelationId              string
}

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

Example

This example demonstrates how to create and use a Blob service Shared Access Signature (SAS)

package main

import (
	"fmt"
	"log"
	"os"
	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}

	containerName := "mycontainer"
	blobName := "HelloWorld.txt"

	sasQueryParams, err := azblob.BlobSASSignatureValues{
		Protocol:      azblob.SASProtocolHTTPS,
		ExpiryTime:    time.Now().UTC().Add(48 * time.Hour),
		ContainerName: containerName,
		BlobName:      blobName,
		Permissions:   azblob.BlobSASPermissions{Add: true, Read: true, Write: true}.String(),
	}.NewSASQueryParameters(credential)
	if err != nil {
		log.Fatal(err)
	}

	// Create the SAS URL for the resource you wish to access, and append the SAS query parameters.
	qp := sasQueryParams.Encode()
	sasURL := fmt.Sprintf("https://%s.blob.core.windows.net/%s/%s?%s", accountName, containerName, blobName, qp)

	// Access the SAS-protected resource
	blob, err := azblob.NewBlobClientWithNoCredential(sasURL, nil)
	if err != nil {
		log.Fatal(err)
	}

	// if you have a SAS query parameter string, you can parse it into it's parts.
	blobURLParts := azblob.NewBlobURLParts(blob.URL())
	fmt.Printf("SAS expiry time=%v", blobURLParts.SAS.ExpiryTime())
}
Output:

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 BlobTag struct {
	// REQUIRED
	Key *string `xml:"Key"`

	// REQUIRED
	Value *string `xml:"Value"`
}

type BlobTags

type BlobTags struct {
	// REQUIRED
	BlobTagSet []*BlobTag `xml:"TagSet>Tag"`
}

BlobTags - Blob tags

func (BlobTags) MarshalXML

func (b BlobTags) MarshalXML(e *xml.Encoder, start xml.StartElement) error

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

func (c BlobType) ToPtr() *BlobType

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.

Example

This example demonstrates splitting a URL into its parts so you can examine and modify the URL in an Azure Storage fluent way.

package main

import (
	"fmt"

	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	// Here is an example of a blob snapshot.
	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 := azblob.NewBlobURLParts(u)

	// The BlobURLParts allows access to individual portions of a Blob URL
	fmt.Printf("Host: %s\nContainerName: %s\nBlobName: %s\nSnapshot: %s\n", parts.Host, parts.ContainerName, parts.BlobName, parts.Snapshot)
	fmt.Printf("Version: %s\nResource: %s\nStartTime: %s\nExpiryTime: %s\nPermissions: %s\n", parts.SAS.Version(), parts.SAS.Resource(), parts.SAS.StartTime(), parts.SAS.ExpiryTime(), parts.SAS.Permissions())

	// You can alter fields to construct a new URL:
	// Note: SAS tokens may be limited to a specific container or blob, be careful modifying SAS tokens, you might take them outside of their original scope accidentally.
	parts.SAS = azblob.SASQueryParameters{}
	parts.Snapshot = ""
	parts.ContainerName = "othercontainer"

	// construct a new URL from the parts
	fmt.Print(parts.URL())
}
Output:

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.

Example

ExampleBlockBlobClient shows how to upload 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. The maximum size of a block blob is slightly more than 4.75 TB (100 MB X 50,000 blocks).

package main

import (
	"bytes"
	"context"
	"encoding/base64"
	"encoding/binary"
	"fmt"
	"log"
	"os"
	"strings"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	// 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 := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}
	blobClient, err := azblob.NewBlockBlobClientWithSharedKey(u, credential, nil)
	if err != nil {
		log.Fatal(err)
	}

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

		// Upload a block to this blob specifying the Block ID and its content (up to 100MB); this block is uncommitted.
		_, err := blobClient.StageBlock(context.TODO(), base64BlockIDs[index], streaming.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(context.TODO(), 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(context.TODO(), azblob.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.
	get, err := blobClient.Download(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}
	blobData := &bytes.Buffer{}
	reader := get.Body(nil)
	_, err = blobData.ReadFrom(reader)
	if err != nil {
		return
	}
	err = reader.Close()
	if err != nil {
		return
	}
	fmt.Println(blobData)
}
Output:

func NewBlockBlobClient

func NewBlockBlobClient(blobURL string, cred azcore.TokenCredential, options *ClientOptions) (BlockBlobClient, error)

NewBlockBlobClient creates a BlockBlobClient object using the specified URL, Azure AD credential, and options.

func NewBlockBlobClientWithNoCredential added in v0.2.0

func NewBlockBlobClientWithNoCredential(blobURL string, options *ClientOptions) (BlockBlobClient, error)

NewBlockBlobClientWithNoCredential creates a BlockBlobClient object using the specified URL and options.

func NewBlockBlobClientWithSharedKey added in v0.2.0

func NewBlockBlobClientWithSharedKey(blobURL string, cred *SharedKeyCredential, options *ClientOptions) (BlockBlobClient, error)

NewBlockBlobClientWithSharedKey creates a BlockBlobClient object using the specified URL, shared key, and options.

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

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

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

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

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

func (b BlockList) MarshalXML(e *xml.Encoder, start xml.StartElement) error

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.TokenCredential, options *ClientOptions) (ContainerClient, error)

NewContainerClient creates a ContainerClient object using the specified URL, Azure AD credential, and options.

func NewContainerClientFromConnectionString

func NewContainerClientFromConnectionString(connectionString string, containerName string, options *ClientOptions) (ContainerClient, error)

NewContainerClientFromConnectionString creates a ContainerClient object using connection string of an account

func NewContainerClientWithNoCredential added in v0.2.0

func NewContainerClientWithNoCredential(containerURL string, options *ClientOptions) (ContainerClient, error)

NewContainerClientWithNoCredential creates a ContainerClient object using the specified URL and options.

func NewContainerClientWithSharedKey added in v0.2.0

func NewContainerClientWithSharedKey(containerURL string, cred *SharedKeyCredential, options *ClientOptions) (ContainerClient, error)

NewContainerClientWithSharedKey creates a ContainerClient object using the specified URL, shared key, and options.

func (ContainerClient) Create

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

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

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

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 ContainerSASPermissions, 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 credential supplied during creation was a SharedKeyCredential.

func (ContainerClient) ListBlobsFlat

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

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

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.

Example

This example shows how to manipulate a container's permissions.

package main

import (
	"bytes"
	"context"
	"fmt"
	"log"
	"net/http"
	"os"
	"strings"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}

	uri := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer", accountName)
	container, err := azblob.NewContainerClientWithSharedKey(uri, credential, nil)
	if err != nil {
		log.Fatal(err)
	}

	// Create the container
	_, err = container.Create(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}

	// Upload a simple blob.
	blob := container.NewBlockBlobClient("HelloWorld.txt")

	_, err = blob.Upload(context.TODO(), streaming.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 {
		// Change the blob to be a public access blob
		_, err := container.SetAccessPolicy(
			context.TODO(),
			&azblob.SetAccessPolicyOptions{
				ContainerSetAccessPolicyOptions: azblob.ContainerSetAccessPolicyOptions{
					Access: azblob.PublicAccessTypeBlob.ToPtr(),
				},
			},
		)
		if err != nil {
			log.Fatal(err)
		}

		// Now, this works:
		get, err = http.Get(blob.URL())
		if err != nil {
			log.Fatal(err)
		}
		var text bytes.Buffer
		_, err = text.ReadFrom(get.Body)
		if err != nil {
			return
		}
		defer get.Body.Close()

		fmt.Println("Public access blob data: ", text.String())
	}
}
Output:

func (ContainerClient) SetMetadata

SetMetadata sets the container's metadata. For more information, see https://docs.microsoft.com/rest/api/storageservices/set-container-metadata.

Example
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}
	containerClient, err := azblob.NewContainerClientWithSharedKey(fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer", accountName), credential, nil)
	if err != nil {
		log.Fatal(err)
	}

	// Create a container with some metadata, key names are converted to lowercase before being sent to the service.
	// You should always use lowercase letters, especially when querying a map for a metadata key.
	creatingApp, err := os.Executable()
	if err != nil {
		log.Fatal(err)
	}
	_, err = containerClient.Create(context.TODO(), &azblob.CreateContainerOptions{Metadata: map[string]string{"author": "Jeffrey", "app": creatingApp}})
	if err != nil {
		log.Fatal(err)
	}

	// Query the container's metadata
	get, err := containerClient.GetProperties(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}

	if get.Metadata == nil {
		log.Fatal("metadata is empty!")
	}

	for k, v := range get.Metadata {
		fmt.Printf("%s=%s\n", k, v)
	}

	// Update the metadata and write it back to the container
	get.Metadata["author"] = "Aidan"
	_, err = containerClient.SetMetadata(context.TODO(), &azblob.SetMetadataContainerOptions{Metadata: get.Metadata})
	if err != nil {
		log.Fatal(err)
	}

	// NOTE: SetMetadata & SetProperties methods update the container's ETag & LastModified properties
}
Output:

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.

package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	// From the Azure portal, get your Storage account's name and account key.
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	// Use your Storage account's name and key to create a credential object; this is used to access your account.
	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}

	// Create an containerClient object that wraps the container's URL and a default pipeline.
	containerURL := fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer", accountName)
	containerClient, err := azblob.NewContainerClientWithSharedKey(containerURL, credential, nil)
	if err != nil {
		log.Fatal(err)
	}

	// Create a unique ID for the lease
	// A lease ID can be any valid GUID string format. To generate UUIDs, consider the github.com/google/uuid package
	leaseID := "36b1a876-cf98-4eb2-a5c3-6d68489658ff"
	containerLeaseClient, err := containerClient.NewContainerLeaseClient(to.StringPtr(leaseID))
	if err != nil {
		log.Fatal(err)
	}

	// 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(context.TODO(), &azblob.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(context.TODO(), 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(context.TODO(), 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(context.TODO(), &azblob.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.
	newLeaseID := "6b3e65e5-e1bb-4a3f-8b72-13e9bc9cd3bf"
	changeLeaseResponse, err := containerLeaseClient.ChangeLease(context.TODO(),
		&azblob.ChangeLeaseContainerOptions{ProposedLeaseID: to.StringPtr(newLeaseID)})
	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(context.TODO(), 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
	_, err = containerLeaseClient.BreakLease(context.TODO(), &azblob.BreakLeaseContainerOptions{BreakPeriod: to.Int32Ptr(60)})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("The lease was broken, and nobody can acquire a lease for 60 seconds")
}
Output:

func (*ContainerLeaseClient) AcquireLease

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

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

ChangeLease changes the container's lease ID. For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-container.

func (*ContainerLeaseClient) ReleaseLease

ReleaseLease releases the container's previously-acquired lease. For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-container.

func (*ContainerLeaseClient) RenewLease

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

Err returns the last error encountered while paging.

func (*ContainerListBlobFlatSegmentPager) NextPage

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

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

Err returns the last error encountered while paging.

func (*ContainerListBlobHierarchySegmentPager) NextPage

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

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, DeletePreviousVersion, List, Tag bool
	Execute, ModifyOwnership, ModifyPermissions                        bool // Hierarchical Namespace only
}

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. All permissions descriptions can be found here: https://docs.microsoft.com/en-us/rest/api/storageservices/create-service-sas#permissions-for-a-directory-container-or-blob

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 *DataLakeStorageErrorError `json:"error,omitempty"`
	// contains filtered or unexported fields
}

Implements the error and azcore.HTTPResponse interfaces.

type DataLakeStorageErrorError added in v0.3.0

type DataLakeStorageErrorError struct {
	// The service error code.
	Code *string `json:"Code,omitempty"`

	// The service error message.
	Message *string `json:"Message,omitempty"`
}

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

ToPtr returns a *DeleteSnapshotsOptionType pointing to the current value.

type DelimitedTextConfiguration

type DelimitedTextConfiguration struct {
	// REQUIRED; column separator
	ColumnSeparator *string `xml:"ColumnSeparator"`

	// REQUIRED; escape char
	EscapeChar *string `xml:"EscapeChar"`

	// REQUIRED; field quote
	FieldQuote *string `xml:"FieldQuote"`

	// REQUIRED; has headers
	HeadersPresent *bool `xml:"HasHeaders"`

	// REQUIRED; record separator
	RecordSeparator *string `xml:"RecordSeparator"`
}

DelimitedTextConfiguration - delimited text configuration

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

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. Pass in nil for options to accept the default options.

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"
	GeoReplicationStatusTypeUnavailable GeoReplicationStatusType = "unavailable"
)

func PossibleGeoReplicationStatusTypeValues

func PossibleGeoReplicationStatusTypeValues() []GeoReplicationStatusType

PossibleGeoReplicationStatusTypeValues returns the possible values for the GeoReplicationStatusType const type.

func (GeoReplicationStatusType) ToPtr

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

type HTTPGetter func(ctx context.Context, i HTTPGetterInfo) (*http.Response, error)

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 {
	Offset int64
	Count  int64
}

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

func (ipr *IPRange) String() 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 {
	// REQUIRED; record separator
	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

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

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

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

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 containerClient.Delete method.

type ObjectReplicationPolicy

type ObjectReplicationPolicy struct {
	PolicyId *string
	Rules    *[]ObjectReplicationRules
}

type ObjectReplicationRules

type ObjectReplicationRules struct {
	RuleId string
	Status string
}

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.

package main

import (
	"bytes"
	"context"
	"fmt"
	"log"
	"os"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	// From the Azure portal, get your Storage account blob service URL endpoint.
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")

	// 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 := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}
	blobClient, err := azblob.NewPageBlobClientWithSharedKey(u, credential, nil)
	if err != nil {
		log.Fatal(err)
	}

	_, err = blobClient.Create(context.TODO(), azblob.PageBlobPageBytes*4, nil)
	if err != nil {
		log.Fatal(err)
	}

	page := make([]byte, azblob.PageBlobPageBytes)
	copy(page, "Page 0")
	_, err = blobClient.UploadPages(context.TODO(), streaming.NopCloser(bytes.NewReader(page)), nil)
	if err != nil {
		log.Fatal(err)
	}

	copy(page, "Page 1")
	_, err = blobClient.UploadPages(
		context.TODO(),
		streaming.NopCloser(bytes.NewReader(page)),
		&azblob.UploadPagesOptions{PageRange: &azblob.HttpRange{Offset: 0, Count: 2 * azblob.PageBlobPageBytes}},
	)
	if err != nil {
		log.Fatal(err)
	}

	getPages, err := blobClient.GetPageRanges(context.TODO(), azblob.HttpRange{Offset: 0, Count: 10 * azblob.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(context.TODO(), azblob.HttpRange{Offset: 0, Count: 1 * azblob.PageBlobPageBytes}, nil)
	if err != nil {
		log.Fatal(err)
	}

	getPages, err = blobClient.GetPageRanges(context.TODO(), azblob.HttpRange{Offset: 0, Count: 10 * azblob.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(context.TODO(), nil)
	if err != nil {
		log.Fatal(err)
	}
	blobData := &bytes.Buffer{}
	reader := get.Body(nil)
	_, err = blobData.ReadFrom(reader)
	if err != nil {
		return
	}
	err = reader.Close()
	if err != nil {
		return
	}
	fmt.Println(blobData.String())
}
Output:

func NewPageBlobClient

func NewPageBlobClient(blobURL string, cred azcore.TokenCredential, options *ClientOptions) (PageBlobClient, error)

NewPageBlobClient creates a ServiceClient object using the specified URL, Azure AD credential, and options. Example of serviceURL: https://<your_storage_account>.blob.core.windows.net

func NewPageBlobClientWithNoCredential added in v0.2.0

func NewPageBlobClientWithNoCredential(blobURL string, options *ClientOptions) (PageBlobClient, error)

NewPageBlobClientWithNoCredential creates a ServiceClient object using the specified URL and options. Example of serviceURL: https://<your_storage_account>.blob.core.windows.net?<SAS token>

func NewPageBlobClientWithSharedKey added in v0.2.0

func NewPageBlobClientWithSharedKey(blobURL string, cred *SharedKeyCredential, options *ClientOptions) (PageBlobClient, error)

NewPageBlobClientWithSharedKey creates a ServiceClient object using the specified URL, shared key, and options. Example of serviceURL: https://<your_storage_account>.blob.core.windows.net

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

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

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

UpdateSequenceNumber sets the page blob's sequence number.

func (PageBlobClient) UploadPages

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

func (p PageList) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaller interface for type PageList.

type PageRange

type PageRange struct {
	// REQUIRED
	End *int64 `xml:"End"`

	// REQUIRED
	Start *int64 `xml:"Start"`
}

func (*PageRange) Raw

func (pr *PageRange) Raw() (start, end int64)

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

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

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

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) AgentObjectId added in v0.3.0

func (p *SASQueryParameters) AgentObjectId() string

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) PreauthorizedAgentObjectId added in v0.3.0

func (p *SASQueryParameters) PreauthorizedAgentObjectId() 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) SignedCorrelationId added in v0.3.0

func (p *SASQueryParameters) SignedCorrelationId() string

func (*SASQueryParameters) SignedDirectoryDepth added in v0.3.0

func (p *SASQueryParameters) SignedDirectoryDepth() string

func (*SASQueryParameters) SignedExpiry

func (p *SASQueryParameters) SignedExpiry() time.Time

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

func (c SKUName) ToPtr() *SKUName

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

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 Blob Storage service allowing you to manipulate blob containers.

func NewServiceClient

func NewServiceClient(serviceURL string, cred azcore.TokenCredential, options *ClientOptions) (ServiceClient, error)

NewServiceClient creates a ServiceClient object using the specified URL, Azure AD 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 NewServiceClientWithNoCredential added in v0.2.0

func NewServiceClientWithNoCredential(serviceURL string, options *ClientOptions) (ServiceClient, error)

NewServiceClientWithNoCredential creates a ServiceClient object using the specified URL and options. Example of serviceURL: https://<your_storage_account>.blob.core.windows.net?<SAS token>

func NewServiceClientWithSharedKey added in v0.2.0

func NewServiceClientWithSharedKey(serviceURL string, cred *SharedKeyCredential, options *ClientOptions) (ServiceClient, error)

NewServiceClientWithSharedKey creates a ServiceClient object using the specified URL, shared key, and options. Example of serviceURL: https://<your_storage_account>.blob.core.windows.net

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

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 (ServiceClient) GetProperties

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 credential supplied during creation was a SharedKeyCredential. This validity can be checked with CanGetAccountSASToken().

Example

This example demonstrates how to use the SAS token generators, which exist across all clients (Service, Container, Blob, and specialized Blob clients). This example specifically generates an account SAS token.

package main

import (
	"context"
	"fmt"
	"log"
	"os"
	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	accountName, accountKey := os.Getenv("AZURE_STORAGE_ACCOUNT_NAME"), os.Getenv("AZURE_STORAGE_ACCOUNT_KEY")
	credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
	if err != nil {
		log.Fatal(err)
	}
	serviceClient, err := azblob.NewServiceClientWithSharedKey(fmt.Sprintf("https://%s.blob.core.windows.net/", accountName), credential, nil)
	if err != nil {
		log.Fatal(err)
	}

	// Provide the relevant info (services, resource types, permissions, and duration)
	// The SAS token will be valid from this moment onwards.
	accountSAS, err := serviceClient.GetSASToken(
		azblob.AccountSASResourceTypes{Object: true, Service: true, Container: true},
		azblob.AccountSASPermissions{Read: true, List: true},
		azblob.AccountSASServices{Blob: true},
		time.Now(),
		time.Now().Add(48*time.Hour),
	)
	if err != nil {
		log.Fatal(err)
	}

	// This URL can be used to authenticate requests now
	sasURL := fmt.Sprintf("https://%s.blob.core.windows.net/?%s", accountName, accountSAS)
	serviceClientUsingSAS, err := azblob.NewServiceClientWithNoCredential(sasURL, nil)
	if err != nil {
		log.Fatal(err)
	}

	// For example, you can now list all the containers
	pager := serviceClientUsingSAS.ListContainers(nil)
	for pager.NextPage(context.TODO()) {
		for _, container := range pager.PageResponse().ContainerItems {
			fmt.Println(*container.Name)
		}
	}
	if err := pager.Err(); err != nil {
		log.Fatal(err)
	}

	// You can also break a blob URL up into it's constituent parts
	blobURLParts := azblob.NewBlobURLParts(serviceClientUsingSAS.URL())
	fmt.Printf("SAS expiry time = %s\n", blobURLParts.SAS.ExpiryTime())
}
Output:

func (ServiceClient) GetStatistics

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

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

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

Err returns the last error encountered while paging.

func (*ServiceListContainersSegmentPager) NextPage

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

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

Example
package main

import (
	"context"
	"errors"
	"fmt"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
)

func main() {
	/* 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 := azblob.NewContainerClientWithNoCredential("https://myaccount.blob.core.windows.net/mycontainer", nil)
	if err != nil {
		log.Fatal(err)
	}
	_, err = container.Create(context.TODO(), nil)

	if err != nil {
		var stgErr azblob.StorageError

		if errors.As(err, &stgErr) { // We know this error is service-specific
			switch stgErr.ErrorCode {
			case azblob.StorageErrorCodeContainerAlreadyExists:
				// You can also look at the *http.Response that's attached to the error as well.
				if resp := stgErr.Response(); resp != nil {
					fmt.Println(resp.Request)
				}
			case azblob.StorageErrorCodeContainerBeingDeleted:
				// Handle this error ...
			default:
				// Handle other errors ...
			}
		}
	}
}
Output:

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"
	StorageErrorCodeUnauthorizedBlobOverwrite                         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

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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