azblob

package
Version: v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 29 Imported by: 435

Documentation

Overview

Package azblob allows you to manipulate Azure Storage containers and blobs objects.

URL Types

The most common types you'll work with are the XxxURL types. The methods of these types make requests against the Azure Storage Service.

- ServiceURL's          methods perform operations on a storage account.
   - ContainerURL's     methods perform operations on an account's container.
      - BlockBlobURL's  methods perform operations on a container's block blob.
      - AppendBlobURL's methods perform operations on a container's append blob.
      - PageBlobURL's   methods perform operations on a container's page blob.
      - BlobURL's       methods perform operations on a container's blob regardless of the blob's type.

Internally, each XxxURL object contains a URL and a request pipeline. The URL indicates the endpoint where each HTTP request is sent and the pipeline indicates how the outgoing HTTP request and incoming HTTP response is processed. The pipeline specifies things like retry policies, logging, deserialization of HTTP response payloads, and more.

Pipelines are threadsafe and may be shared by multiple XxxURL objects. When you create a ServiceURL, you pass an initial pipeline. When you call ServiceURL's NewContainerURL method, the new ContainerURL object has its own URL but it shares the same pipeline as the parent ServiceURL object.

To work with a blob, call one of ContainerURL's 4 NewXxxBlobURL methods depending on how you want to treat the blob. To treat the blob as a block blob, append blob, or page blob, call NewBlockBlobURL, NewAppendBlobURL, or NewPageBlobURL respectively. These three types are all identical except for the methods they expose; each type exposes the methods relevant to the type of blob represented. If you're not sure how you want to treat a blob, you can call NewBlobURL; this returns an object whose methods are relevant to any kind of blob. When you call ContainerURL's NewXxxBlobURL, the new XxxBlobURL object has its own URL but it shares the same pipeline as the parent ContainerURL object. You can easily switch between blob types (method sets) by calling a ToXxxBlobURL method.

If you'd like to use a different pipeline with a ServiceURL, ContainerURL, or XxxBlobURL object, then call the XxxURL object's WithPipeline method passing in the desired pipeline. The WithPipeline methods create a new XxxURL object with the same URL as the original but with the specified pipeline.

Note that XxxURL objects use little memory, are goroutine-safe, and many objects share the same pipeline. This means that XxxURL objects share a lot of system resources making them very efficient.

All of XxxURL's methods that make HTTP requests return rich error handling information so you can discern network failures, transient failures, timeout failures, service failures, etc. See the StorageError interface for more information and an example of how to do deal with errors.

URL and Shared Access Signature Manipulation

The library includes a BlobURLParts type for deconstructing and reconstructing URLs. And you can use the following types for generating and parsing Shared Access Signature (SAS)

- Use the AccountSASSignatureValues type to create a SAS for a storage account.
- Use the BlobSASSignatureValues type to create a SAS for a container or blob.
- Use the SASQueryParameters type to turn signature values in to query parameres or to parse query parameters.

To generate a SAS, you must use the SharedKeyCredential type.

Credentials

When creating a request pipeline, you must specify one of this package's credential types.

- Call the NewAnonymousCredential function for requests that contain a Shared Access Signature (SAS).
- Call the NewSharedKeyCredential function (with an account name & key) to access any account resources. You must also use this
  to generate Shared Access Signatures.

HTTP Request Policy Factories

This package defines several request policy factories for use with the pipeline package. Most applications will not use these factories directly; instead, the NewPipeline function creates these factories, initializes them (via the PipelineOptions type) and returns a pipeline object for use by the XxxURL objects.

However, for advanced scenarios, developers can access these policy factories directly and even create their own and then construct their own pipeline in order to affect HTTP requests and responses performed by the XxxURL objects. For example, developers can introduce their own logging, random failures, request recording & playback for fast testing, HTTP request pacing, alternate retry mechanisms, metering, metrics, etc. The possibilities are endless!

Below are the request pipeline policy factory functions that are provided with this package:

- NewRetryPolicyFactory           Enables rich retry semantics for failed HTTP requests.
- NewRequestLogPolicyFactory      Enables rich logging support for HTTP requests/responses & failures.
- NewTelemetryPolicyFactory       Enables simple modification of the HTTP request's User-Agent header so each request reports the SDK version & language/runtime making the requests.
- NewUniqueRequestIDPolicyFactory Adds a x-ms-client-request-id header with a unique UUID value to an HTTP request to help with diagnosing failures.

Also, note that all the NewXxxCredential functions return request policy factory objects which get injected into the pipeline.

Example

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

// From the Azure portal, get your Storage account's name and account key.
accountName, accountKey := accountInfo()

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

// Create a request pipeline that is used to process HTTP(S) requests and responses. It requires
// your account credentials. In more advanced scenarios, you can configure telemetry, retry policies,
// logging, and other options. Also, you can configure multiple request pipelines for different scenarios.
p := NewPipeline(credential, PipelineOptions{})

// From the Azure portal, get your Storage account blob service URL endpoint.
// The URL typically looks like this:
u, _ := url.Parse(fmt.Sprintf("https://%s.blob.core.windows.net", accountName))

// Create an ServiceURL object that wraps the service URL and a request pipeline.
serviceURL := NewServiceURL(*u, p)

// Now, you can use the serviceURL to perform various container and blob operations.

// All HTTP operations allow you to specify a Go context.Context object to control cancellation/timeout.
ctx := context.Background() // This example uses a never-expiring context.

// This example shows several common operations just to get you started.

// Create a URL that references a to-be-created container in your Azure Storage account.
// This returns a ContainerURL object that wraps the container's URL and a request pipeline (inherited from serviceURL)
containerURL := serviceURL.NewContainerURL("mycontainer") // Container names require lowercase

// Create the container on the service (with no metadata and no public access)
_, err = containerURL.Create(ctx, Metadata{}, PublicAccessNone)
if err != nil {
	log.Fatal(err)
}

// Create a URL that references a to-be-created blob in your Azure Storage account's container.
// This returns a BlockBlobURL object that wraps the blob's URL and a request pipeline (inherited from containerURL)
blobURL := containerURL.NewBlockBlobURL("HelloWorld.txt") // Blob names can be mixed case

// Create the blob with string (plain text) content.
data := "Hello World!"
_, err = blobURL.Upload(ctx, strings.NewReader(data), BlobHTTPHeaders{ContentType: "text/plain"}, Metadata{}, BlobAccessConditions{}, DefaultAccessTier, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{})
if err != nil {
	log.Fatal(err)
}

// Download the blob's contents and verify that it worked correctly
get, err := blobURL.Download(ctx, 0, 0, BlobAccessConditions{}, false, ClientProvidedKeyOptions{})
if err != nil {
	log.Fatal(err)
}

downloadedData := &bytes.Buffer{}
reader := get.Body(RetryReaderOptions{})
downloadedData.ReadFrom(reader)
reader.Close() // The client must close the response body when finished with it
if data != downloadedData.String() {
	log.Fatal("downloaded data doesn't match uploaded data")
}

// List the blob(s) in our container; since a container may hold millions of blobs, this is done 1 segment at a time.
for marker := (Marker{}); marker.NotDone(); { // The parens around Marker{} are required to avoid compiler error.
	// Get a result segment starting with the blob indicated by the current Marker.
	listBlob, err := containerURL.ListBlobsFlatSegment(ctx, marker, ListBlobsSegmentOptions{})
	if err != nil {
		log.Fatal(err)
	}
	// IMPORTANT: ListBlobs returns the start of the next segment; you MUST use this to get
	// the next segment (after processing the current result segment).
	marker = listBlob.NextMarker

	// Process the blobs returned in this result segment (if the segment is empty, the loop body won't execute)
	for _, blobInfo := range listBlob.Segment.BlobItems {
		fmt.Print("Blob name: " + blobInfo.Name + "\n")
	}
}

// Delete the blob we created earlier.
_, err = blobURL.Delete(ctx, DeleteSnapshotsOptionNone, BlobAccessConditions{})
if err != nil {
	log.Fatal(err)
}

// Delete the container we created earlier.
_, err = containerURL.Delete(ctx, ContainerAccessConditions{})
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 hot to delete blob snapshots.

// From the Azure portal, get your Storage account blob service URL endpoint.
accountName, accountKey := accountInfo()

// Create a ContainerURL object to a container where we'll create a blob and its snapshot.
u, _ := url.Parse(fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer", accountName))
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
	log.Fatal(err)
}
containerURL := NewContainerURL(*u, NewPipeline(credential, PipelineOptions{}))

// Create a BlockBlobURL object to a blob in the container.
baseBlobURL := containerURL.NewBlockBlobURL("Original.txt")

ctx := context.Background() // This example uses a never-expiring context

// Create the original blob:
_, err = baseBlobURL.Upload(ctx, strings.NewReader("Some text"), BlobHTTPHeaders{}, Metadata{}, BlobAccessConditions{}, DefaultAccessTier, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{})
if err != nil {
	log.Fatal(err)
}

// Create a snapshot of the original blob & save its timestamp:
createSnapshot, err := baseBlobURL.CreateSnapshot(ctx, Metadata{}, BlobAccessConditions{}, ClientProvidedKeyOptions{})
snapshot := createSnapshot.Snapshot()

// Modify the original blob & show it:
_, err = baseBlobURL.Upload(ctx, strings.NewReader("New text"), BlobHTTPHeaders{}, Metadata{}, BlobAccessConditions{}, DefaultAccessTier, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{})
if err != nil {
	log.Fatal(err)
}

get, err := baseBlobURL.Download(ctx, 0, 0, BlobAccessConditions{}, false, ClientProvidedKeyOptions{})
b := bytes.Buffer{}
reader := get.Body(RetryReaderOptions{})
b.ReadFrom(reader)
reader.Close() // The client must close the response body when finished with it
fmt.Println(b.String())

// Show snapshot blob via original blob URI & snapshot time:
snapshotBlobURL := baseBlobURL.WithSnapshot(snapshot)
get, err = snapshotBlobURL.Download(ctx, 0, 0, BlobAccessConditions{}, false, ClientProvidedKeyOptions{})
b.Reset()
reader = get.Body(RetryReaderOptions{})
b.ReadFrom(reader)
reader.Close() // The client must close the response body when finished with it
fmt.Println(b.String())

// FYI: You can get the base blob URL from one of its snapshot by passing "" to WithSnapshot:
baseBlobURL = snapshotBlobURL.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.
for marker := (Marker{}); marker.NotDone(); { // The parens around Marker{} are required to avoid compiler error.
	// Get a result segment starting with the blob indicated by the current Marker.
	listBlobs, err := containerURL.ListBlobsFlatSegment(ctx, marker, ListBlobsSegmentOptions{
		Details: BlobListingDetails{Snapshots: true}})
	if err != nil {
		log.Fatal(err)
	}
	// IMPORTANT: ListBlobs returns the start of the next segment; you MUST use this to get
	// the next segment (after processing the current result segment).
	marker = listBlobs.NextMarker

	// Process the blobs returned in this result segment (if the segment is empty, the loop body won't execute)
	for _, blobInfo := range listBlobs.Segment.BlobItems {
		snaptime := "N/A"
		if blobInfo.Snapshot != "" {
			snaptime = blobInfo.Snapshot
		}
		fmt.Printf("Blob name: %s, Snapshot: %s\n", blobInfo.Name, snaptime)
	}
}

// Promote read-only snapshot to writable base blob:
_, err = baseBlobURL.StartCopyFromURL(ctx, snapshotBlobURL.URL(), Metadata{}, ModifiedAccessConditions{}, BlobAccessConditions{}, DefaultAccessTier, 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 = baseBlobURL.Delete(ctx, DeleteSnapshotsOptionInclude, BlobAccessConditions{})
if err != nil {
	log.Fatal(err)
}
Output:

Example (ProgressUploadDownload)
// Create a request pipeline using your Storage account's name and account key.
accountName, accountKey := accountInfo()
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
	log.Fatal(err)
}
p := NewPipeline(credential, PipelineOptions{})

// From the Azure portal, get your Storage account blob service URL endpoint.
cURL, _ := url.Parse(fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer", accountName))

// Create an ServiceURL object that wraps the service URL and a request pipeline to making requests.
containerURL := NewContainerURL(*cURL, p)

ctx := context.Background() // This example uses a never-expiring context
// Here's how to create a blob with HTTP headers and metadata (I'm using the same metadata that was put on the container):
blobURL := containerURL.NewBlockBlobURL("Data.bin")

// requestBody is the stream of data to write
requestBody := strings.NewReader("Some text to write")

// Wrap the request body in a RequestBodyProgress and pass a callback function for progress reporting.
_, err = blobURL.Upload(ctx, pipeline.NewRequestBodyProgress(requestBody, func(bytesTransferred int64) {
	fmt.Printf("Wrote %d of %d bytes.", bytesTransferred, requestBody.Size())
}), BlobHTTPHeaders{
	ContentType:        "text/html; charset=utf-8",
	ContentDisposition: "attachment",
}, Metadata{}, BlobAccessConditions{}, DefaultAccessTier, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{})
if err != nil {
	log.Fatal(err)
}

// Here's how to read the blob's data with progress reporting:
get, err := blobURL.Download(ctx, 0, 0, BlobAccessConditions{}, false, ClientProvidedKeyOptions{})
if err != nil {
	log.Fatal(err)
}

// Wrap the response body in a ResponseBodyProgress and pass a callback function for progress reporting.
responseBody := pipeline.NewResponseBodyProgress(get.Body(RetryReaderOptions{}),
	func(bytesTransferred int64) {
		fmt.Printf("Read %d of %d bytes.", bytesTransferred, get.ContentLength())
	})

downloadedData := &bytes.Buffer{}
downloadedData.ReadFrom(responseBody)
responseBody.Close() // The client must close the response body when finished with it
// The downloaded blob data is in downloadData's buffer
Output:

Index

Examples

Constants

View Source
const (
	// AppendBlobMaxAppendBlockBytes indicates the maximum number of bytes that can be sent in a call to AppendBlock.
	AppendBlobMaxAppendBlockBytes = 4 * 1024 * 1024 // 4MB

	// AppendBlobMaxBlocks indicates the maximum number of blocks allowed in an append blob.
	AppendBlobMaxBlocks = 50000
)
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 // 4000MiB

	// BlockBlobMaxBlocks indicates the maximum number of blocks allowed in a block blob.
	BlockBlobMaxBlocks = 50000
)
View Source
const (
	// PageBlobPageBytes indicates the number of bytes in a page (512).
	PageBlobPageBytes = 512

	// PageBlobMaxUploadPagesBytes indicates the maximum number of bytes that can be sent in a call to PutPage.
	PageBlobMaxUploadPagesBytes = 4 * 1024 * 1024 // 4MB
)
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"
)
View Source
const BlobDefaultDownloadBlockSize = int64(4 * 1024 * 1024) // 4MB
View Source
const CountToEnd = 0
View Source
const LeaseBreakNaturally = -1

LeaseBreakNaturally tells ContainerURL's or BlobURL's BreakLease method to break the lease using service semantics.

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 = ServiceVersion

SASVersion indicates the SAS version.

View Source
const (
	// ServiceVersion specifies the version of the operations used in this package.
	ServiceVersion = "2020-10-02"
)
View Source
const (
	SnapshotTimeFormat = "2006-01-02T15:04:05.0000000Z07:00"
)

Variables

View Source
var DefaultAccessTier = AccessTierNone
View Source
var DefaultPremiumBlobAccessTier = PremiumPageBlobAccessTierNone
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 added in v0.8.0

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 DownloadBlobToBuffer

func DownloadBlobToBuffer(ctx context.Context, blobURL BlobURL, offset int64, count int64,
	b []byte, o DownloadFromBlobOptions) 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 DownloadBlobToFile

func DownloadBlobToFile(ctx context.Context, blobURL BlobURL, offset int64, count int64,
	file *os.File, o DownloadFromBlobOptions) 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 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 NewPipeline

func NewPipeline(c Credential, o PipelineOptions) pipeline.Pipeline

NewPipeline creates a Pipeline using the specified credentials and options.

Example

This example shows how you can configure a pipeline for making HTTP requests to the Azure Storage Blob Service.

// This example shows how to wire in your own logging mechanism (this example uses
// Go's standard logger to write log information to standard error)
logger := log.New(os.Stderr, "", log.Ldate|log.Lmicroseconds)

// Create/configure a request pipeline options object.
// All PipelineOptions' fields are optional; reasonable defaults are set for anything you do not specify
po := PipelineOptions{
	// Set RetryOptions to control how HTTP request are retried when retryable failures occur
	Retry: RetryOptions{
		Policy:        RetryPolicyExponential, // Use exponential backoff as opposed to linear
		MaxTries:      3,                      // Try at most 3 times to perform the operation (set to 1 to disable retries)
		TryTimeout:    time.Second * 3,        // Maximum time allowed for any single try
		RetryDelay:    time.Second * 1,        // Backoff amount for each retry (exponential or linear)
		MaxRetryDelay: time.Second * 3,        // Max delay between retries
	},

	// Set RequestLogOptions to control how each HTTP request & its response is logged
	RequestLog: RequestLogOptions{
		LogWarningIfTryOverThreshold: time.Millisecond * 200, // A successful response taking more than this time to arrive is logged as a warning
		SyslogDisabled:               true,
	},

	// Set LogOptions to control what & where all pipeline log events go
	Log: pipeline.LogOptions{
		Log: func(s pipeline.LogLevel, m string) { // This func is called to log each event
			// This method is not called for filtered-out severities.
			logger.Output(2, m) // This example uses Go's standard logger
		},
		ShouldLog: func(level pipeline.LogLevel) bool {
			return level <= pipeline.LogWarning // Log all events from warning to more severe
		},
	},

	// Set HTTPSender to override the default HTTP Sender that sends the request over the network
	HTTPSender: pipeline.FactoryFunc(func(next pipeline.Policy, po *pipeline.PolicyOptions) pipeline.PolicyFunc {
		return func(ctx context.Context, request pipeline.Request) (pipeline.Response, error) {
			// Implement the HTTP client that will override the default sender.
			// For example, below HTTP client uses a transport that is different from http.DefaultTransport
			client := http.Client{
				Transport: &http.Transport{
					Proxy: nil,
					DialContext: (&net.Dialer{
						Timeout:   30 * time.Second,
						KeepAlive: 30 * time.Second,
						DualStack: true,
					}).DialContext,
					MaxIdleConns:          100,
					IdleConnTimeout:       180 * time.Second,
					TLSHandshakeTimeout:   10 * time.Second,
					ExpectContinueTimeout: 1 * time.Second,
				},
			}

			// Send the request over the network
			resp, err := client.Do(request.WithContext(ctx))

			return pipeline.NewHTTPResponse(resp), err
		}
	}),
}

// Create a request pipeline object configured with credentials and with pipeline options. Once created,
// a pipeline object is goroutine-safe and can be safely used with many XxxURL objects simultaneously.
p := NewPipeline(NewAnonymousCredential(), po) // A pipeline always requires some credential object

// Once you've created a pipeline object, associate it with an XxxURL object so that you can perform HTTP requests with it.
u, _ := url.Parse("https://myaccount.blob.core.windows.net")
serviceURL := NewServiceURL(*u, p)
// Use the serviceURL as desired...

// NOTE: When you use an XxxURL object to create another XxxURL object, the new XxxURL object inherits the
// same pipeline object as its parent. For example, the containerURL and blobURL objects (created below)
// all share the same pipeline. Any HTTP operations you perform with these objects share the behavior (retry, logging, etc.)
containerURL := serviceURL.NewContainerURL("mycontainer")
blobURL := containerURL.NewBlockBlobURL("ReadMe.txt")

// If you'd like to perform some operations with different behavior, create a new pipeline object and
// associate it with a new XxxURL object by passing the new pipeline to the XxxURL object's WithPipeline method.

// In this example, I reconfigure the retry policies, create a new pipeline, and then create a new
// ContainerURL object that has the same URL as its parent.
po.Retry = RetryOptions{
	Policy:        RetryPolicyFixed, // Use fixed time backoff
	MaxTries:      4,                // Try at most 3 times to perform the operation (set to 1 to disable retries)
	TryTimeout:    time.Minute * 1,  // Maximum time allowed for any single try
	RetryDelay:    time.Second * 5,  // Backoff amount for each retry (exponential or linear)
	MaxRetryDelay: time.Second * 10, // Max delay between retries
}
newContainerURL := containerURL.WithPipeline(NewPipeline(NewAnonymousCredential(), po))

// Now, any XxxBlobURL object created using newContainerURL inherits the pipeline with the new retry policy.
newBlobURL := newContainerURL.NewBlockBlobURL("ReadMe.txt")
_, _ = blobURL, newBlobURL // Avoid compiler's "declared and not used" error
Output:

func NewRequestLogPolicyFactory

func NewRequestLogPolicyFactory(o RequestLogOptions) pipeline.Factory

NewRequestLogPolicyFactory creates a RequestLogPolicyFactory object configured using the specified options.

func NewResponseError

func NewResponseError(cause error, response *http.Response, description string) error

NewResponseError creates an error object that implements the error interface.

func NewRetryPolicyFactory

func NewRetryPolicyFactory(o RetryOptions) pipeline.Factory

NewRetryPolicyFactory creates a RetryPolicyFactory object configured using the specified options.

func NewRetryReader

func NewRetryReader(ctx context.Context, initialResponse *http.Response,
	info HTTPGetterInfo, o RetryReaderOptions, getter HTTPGetter) io.ReadCloser

NewRetryReader creates a retry reader.

func NewTelemetryPolicyFactory

func NewTelemetryPolicyFactory(o TelemetryOptions) pipeline.Factory

NewTelemetryPolicyFactory creates a factory that can create telemetry policy objects which add telemetry information to outgoing HTTP requests.

func NewUniqueRequestIDPolicyFactory

func NewUniqueRequestIDPolicyFactory() pipeline.Factory

NewUniqueRequestIDPolicyFactory creates a UniqueRequestIDPolicyFactory object that sets the request's x-ms-client-request-id header if it doesn't already exist.

func RedactSigQueryParam

func RedactSigQueryParam(rawQuery string) (bool, string)

RedactSigQueryParam redacts the 'sig' query parameter in URL's raw query to protect secret.

func SerializeBlobTagsHeader added in v0.11.0

func SerializeBlobTagsHeader(blobTagsMap BlobTagsMap) *string

func UserAgent

func UserAgent() string

UserAgent returns the UserAgent string to use when sending http.Requests.

func Version

func Version() string

Version returns the semantic version (see http://semver.org) of the client.

Types

type AccessPolicy

type AccessPolicy struct {
	// Start - the date-time the policy is active
	Start *time.Time `xml:"Start"`
	// Expiry - the date-time the policy expires
	Expiry *time.Time `xml:"Expiry"`
	// Permission - the permissions for the acl policy
	Permission *string `xml:"Permission"`
}

AccessPolicy - An Access policy

func (AccessPolicy) MarshalXML

func (ap AccessPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for AccessPolicy.

func (*AccessPolicy) UnmarshalXML

func (ap *AccessPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements the xml.Unmarshaler interface for 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 AccessTierType

type AccessTierType string

AccessTierType enumerates the values for access tier type.

const (
	// AccessTierArchive ...
	AccessTierArchive AccessTierType = "Archive"
	// AccessTierCool ...
	AccessTierCool AccessTierType = "Cool"
	// AccessTierHot ...
	AccessTierHot AccessTierType = "Hot"
	// AccessTierNone represents an empty AccessTierType.
	AccessTierNone AccessTierType = ""
	// AccessTierP10 ...
	AccessTierP10 AccessTierType = "P10"
	// AccessTierP15 ...
	AccessTierP15 AccessTierType = "P15"
	// AccessTierP20 ...
	AccessTierP20 AccessTierType = "P20"
	// AccessTierP30 ...
	AccessTierP30 AccessTierType = "P30"
	// AccessTierP4 ...
	AccessTierP4 AccessTierType = "P4"
	// AccessTierP40 ...
	AccessTierP40 AccessTierType = "P40"
	// AccessTierP50 ...
	AccessTierP50 AccessTierType = "P50"
	// AccessTierP6 ...
	AccessTierP6 AccessTierType = "P6"
	// AccessTierP60 ...
	AccessTierP60 AccessTierType = "P60"
	// AccessTierP70 ...
	AccessTierP70 AccessTierType = "P70"
	// AccessTierP80 ...
	AccessTierP80 AccessTierType = "P80"
)

func PossibleAccessTierTypeValues

func PossibleAccessTierTypeValues() []AccessTierType

PossibleAccessTierTypeValues returns an array of possible values for the AccessTierType const type.

type AccountKindType

type AccountKindType string

AccountKindType enumerates the values for account kind type.

const (
	// AccountKindBlobStorage ...
	AccountKindBlobStorage AccountKindType = "BlobStorage"
	// AccountKindBlockBlobStorage ...
	AccountKindBlockBlobStorage AccountKindType = "BlockBlobStorage"
	// AccountKindFileStorage ...
	AccountKindFileStorage AccountKindType = "FileStorage"
	// AccountKindNone represents an empty AccountKindType.
	AccountKindNone AccountKindType = ""
	// AccountKindStorage ...
	AccountKindStorage AccountKindType = "Storage"
	// AccountKindStorageV2 ...
	AccountKindStorageV2 AccountKindType = "StorageV2"
)

func PossibleAccountKindTypeValues

func PossibleAccountKindTypeValues() []AccountKindType

PossibleAccountKindTypeValues returns an array of possible values for the AccountKindType const type.

type AccountSASPermissions

type AccountSASPermissions struct {
	Read, Write, Delete, DeletePreviousVersion, List, Add, Create, Update, Process, Tag, FilterByTags, PermanentDelete, Immutability 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 (a *AccountSASServices) Parse(s 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

Example

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

// From the Azure portal, get your Storage account's name and account key.
accountName, accountKey := accountInfo()

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

// Set the desired SAS signature values and sign them with the shared key credentials to get the SAS query parameters.
sasQueryParams, err := AccountSASSignatureValues{
	Protocol:      SASProtocolHTTPS,                     // Users MUST use HTTPS (not HTTP)
	ExpiryTime:    time.Now().UTC().Add(48 * time.Hour), // 48-hours before expiration
	Permissions:   AccountSASPermissions{Read: true, List: true}.String(),
	Services:      AccountSASServices{Blob: true}.String(),
	ResourceTypes: AccountSASResourceTypes{Container: true, Object: true}.String(),
}.NewSASQueryParameters(credential)
if err != nil {
	log.Fatal(err)
}

qp := sasQueryParams.Encode()
urlToSendToSomeone := fmt.Sprintf("https://%s.blob.core.windows.net?%s", accountName, qp)
// At this point, you can send the urlToSendToSomeone to someone via email or any other mechanism you choose.

// ************************************************************************************************

// When someone receives the URL, they access the SAS-protected resource with code like this:
u, _ := url.Parse(urlToSendToSomeone)

// Create an ServiceURL object that wraps the service URL (and its SAS) and a pipeline.
// When using a SAS URLs, anonymous credentials are required.
serviceURL := NewServiceURL(*u, NewPipeline(NewAnonymousCredential(), PipelineOptions{}))
// Now, you can use this serviceURL just like any other to make requests of the resource.

// You can parse a URL into its constituent parts:
blobURLParts := NewBlobURLParts(serviceURL.URL())
fmt.Printf("SAS expiry time=%v", blobURLParts.SAS.ExpiryTime())

_ = serviceURL // Avoid compiler's "declared and not used" error
Output:

func (AccountSASSignatureValues) NewSASQueryParameters

func (v AccountSASSignatureValues) NewSASQueryParameters(sharedKeyCredential *SharedKeyCredential) (SASQueryParameters, error)

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

type AppendBlobAppendBlockFromURLResponse

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

AppendBlobAppendBlockFromURLResponse ...

func (AppendBlobAppendBlockFromURLResponse) BlobAppendOffset

func (ababfur AppendBlobAppendBlockFromURLResponse) BlobAppendOffset() string

BlobAppendOffset returns the value for header x-ms-blob-append-offset.

func (AppendBlobAppendBlockFromURLResponse) BlobCommittedBlockCount

func (ababfur AppendBlobAppendBlockFromURLResponse) BlobCommittedBlockCount() int32

BlobCommittedBlockCount returns the value for header x-ms-blob-committed-block-count.

func (AppendBlobAppendBlockFromURLResponse) ContentMD5

func (ababfur AppendBlobAppendBlockFromURLResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (AppendBlobAppendBlockFromURLResponse) Date

Date returns the value for header Date.

func (AppendBlobAppendBlockFromURLResponse) ETag

ETag returns the value for header ETag.

func (AppendBlobAppendBlockFromURLResponse) EncryptionKeySha256 added in v0.10.0

func (ababfur AppendBlobAppendBlockFromURLResponse) EncryptionKeySha256() string

EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256.

func (AppendBlobAppendBlockFromURLResponse) EncryptionScope added in v0.11.0

func (ababfur AppendBlobAppendBlockFromURLResponse) EncryptionScope() string

EncryptionScope returns the value for header x-ms-encryption-scope.

func (AppendBlobAppendBlockFromURLResponse) ErrorCode

func (ababfur AppendBlobAppendBlockFromURLResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (AppendBlobAppendBlockFromURLResponse) IsServerEncrypted added in v0.10.0

func (ababfur AppendBlobAppendBlockFromURLResponse) IsServerEncrypted() string

IsServerEncrypted returns the value for header x-ms-request-server-encrypted.

func (AppendBlobAppendBlockFromURLResponse) LastModified

func (ababfur AppendBlobAppendBlockFromURLResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (AppendBlobAppendBlockFromURLResponse) RequestID

func (ababfur AppendBlobAppendBlockFromURLResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (AppendBlobAppendBlockFromURLResponse) Response

Response returns the raw HTTP response object.

func (AppendBlobAppendBlockFromURLResponse) Status

Status returns the HTTP status message of the response, e.g. "200 OK".

func (AppendBlobAppendBlockFromURLResponse) StatusCode

func (ababfur AppendBlobAppendBlockFromURLResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (AppendBlobAppendBlockFromURLResponse) Version

func (ababfur AppendBlobAppendBlockFromURLResponse) Version() string

Version returns the value for header x-ms-version.

func (AppendBlobAppendBlockFromURLResponse) XMsContentCrc64 added in v0.10.0

func (ababfur AppendBlobAppendBlockFromURLResponse) XMsContentCrc64() []byte

XMsContentCrc64 returns the value for header x-ms-content-crc64.

type AppendBlobAppendBlockResponse

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

AppendBlobAppendBlockResponse ...

func (AppendBlobAppendBlockResponse) BlobAppendOffset

func (ababr AppendBlobAppendBlockResponse) BlobAppendOffset() string

BlobAppendOffset returns the value for header x-ms-blob-append-offset.

func (AppendBlobAppendBlockResponse) BlobCommittedBlockCount

func (ababr AppendBlobAppendBlockResponse) BlobCommittedBlockCount() int32

BlobCommittedBlockCount returns the value for header x-ms-blob-committed-block-count.

func (AppendBlobAppendBlockResponse) ClientRequestID added in v0.10.0

func (ababr AppendBlobAppendBlockResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (AppendBlobAppendBlockResponse) ContentMD5

func (ababr AppendBlobAppendBlockResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (AppendBlobAppendBlockResponse) Date

Date returns the value for header Date.

func (AppendBlobAppendBlockResponse) ETag

func (ababr AppendBlobAppendBlockResponse) ETag() ETag

ETag returns the value for header ETag.

func (AppendBlobAppendBlockResponse) EncryptionKeySha256 added in v0.10.0

func (ababr AppendBlobAppendBlockResponse) EncryptionKeySha256() string

EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256.

func (AppendBlobAppendBlockResponse) EncryptionScope added in v0.11.0

func (ababr AppendBlobAppendBlockResponse) EncryptionScope() string

EncryptionScope returns the value for header x-ms-encryption-scope.

func (AppendBlobAppendBlockResponse) ErrorCode

func (ababr AppendBlobAppendBlockResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (AppendBlobAppendBlockResponse) IsServerEncrypted added in v0.7.0

func (ababr AppendBlobAppendBlockResponse) IsServerEncrypted() string

IsServerEncrypted returns the value for header x-ms-request-server-encrypted.

func (AppendBlobAppendBlockResponse) LastModified

func (ababr AppendBlobAppendBlockResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (AppendBlobAppendBlockResponse) RequestID

func (ababr AppendBlobAppendBlockResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (AppendBlobAppendBlockResponse) Response

func (ababr AppendBlobAppendBlockResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (AppendBlobAppendBlockResponse) Status

func (ababr AppendBlobAppendBlockResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (AppendBlobAppendBlockResponse) StatusCode

func (ababr AppendBlobAppendBlockResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (AppendBlobAppendBlockResponse) Version

func (ababr AppendBlobAppendBlockResponse) Version() string

Version returns the value for header x-ms-version.

func (AppendBlobAppendBlockResponse) XMsContentCrc64 added in v0.10.0

func (ababr AppendBlobAppendBlockResponse) XMsContentCrc64() []byte

XMsContentCrc64 returns the value for header x-ms-content-crc64.

type AppendBlobCreateResponse

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

AppendBlobCreateResponse ...

func (AppendBlobCreateResponse) ClientRequestID added in v0.10.0

func (abcr AppendBlobCreateResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (AppendBlobCreateResponse) ContentMD5

func (abcr AppendBlobCreateResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (AppendBlobCreateResponse) Date

func (abcr AppendBlobCreateResponse) Date() time.Time

Date returns the value for header Date.

func (AppendBlobCreateResponse) ETag

func (abcr AppendBlobCreateResponse) ETag() ETag

ETag returns the value for header ETag.

func (AppendBlobCreateResponse) EncryptionKeySha256 added in v0.10.0

func (abcr AppendBlobCreateResponse) EncryptionKeySha256() string

EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256.

func (AppendBlobCreateResponse) EncryptionScope added in v0.11.0

func (abcr AppendBlobCreateResponse) EncryptionScope() string

EncryptionScope returns the value for header x-ms-encryption-scope.

func (AppendBlobCreateResponse) ErrorCode

func (abcr AppendBlobCreateResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (AppendBlobCreateResponse) IsServerEncrypted

func (abcr AppendBlobCreateResponse) IsServerEncrypted() string

IsServerEncrypted returns the value for header x-ms-request-server-encrypted.

func (AppendBlobCreateResponse) LastModified

func (abcr AppendBlobCreateResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (AppendBlobCreateResponse) RequestID

func (abcr AppendBlobCreateResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (AppendBlobCreateResponse) Response

func (abcr AppendBlobCreateResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (AppendBlobCreateResponse) Status

func (abcr AppendBlobCreateResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (AppendBlobCreateResponse) StatusCode

func (abcr AppendBlobCreateResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (AppendBlobCreateResponse) Version

func (abcr AppendBlobCreateResponse) Version() string

Version returns the value for header x-ms-version.

func (AppendBlobCreateResponse) VersionID added in v0.11.0

func (abcr AppendBlobCreateResponse) VersionID() string

VersionID returns the value for header x-ms-version-id.

type AppendBlobSealResponse added in v0.11.0

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

AppendBlobSealResponse ...

func (AppendBlobSealResponse) ClientRequestID added in v0.11.0

func (absr AppendBlobSealResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (AppendBlobSealResponse) Date added in v0.11.0

func (absr AppendBlobSealResponse) Date() time.Time

Date returns the value for header Date.

func (AppendBlobSealResponse) ETag added in v0.11.0

func (absr AppendBlobSealResponse) ETag() ETag

ETag returns the value for header ETag.

func (AppendBlobSealResponse) ErrorCode added in v0.11.0

func (absr AppendBlobSealResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (AppendBlobSealResponse) IsSealed added in v0.11.0

func (absr AppendBlobSealResponse) IsSealed() string

IsSealed returns the value for header x-ms-blob-sealed.

func (AppendBlobSealResponse) LastModified added in v0.11.0

func (absr AppendBlobSealResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (AppendBlobSealResponse) RequestID added in v0.11.0

func (absr AppendBlobSealResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (AppendBlobSealResponse) Response added in v0.11.0

func (absr AppendBlobSealResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (AppendBlobSealResponse) Status added in v0.11.0

func (absr AppendBlobSealResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (AppendBlobSealResponse) StatusCode added in v0.11.0

func (absr AppendBlobSealResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (AppendBlobSealResponse) Version added in v0.11.0

func (absr AppendBlobSealResponse) Version() string

Version returns the value for header x-ms-version.

type AppendBlobURL

type AppendBlobURL struct {
	BlobURL
	// contains filtered or unexported fields
}

AppendBlobURL defines a set of operations applicable to append blobs.

Example

ExampleAppendBlobURL shows how to append data (in blocks) to an append blob. An append blob can have a maximum of 50,000 blocks; each block can have a maximum of 100MB. Therefore, the maximum size of an append blob is slightly more than 4.75 TB (100 MB X 50,000 blocks).

// From the Azure portal, get your Storage account blob service URL endpoint.
accountName, accountKey := accountInfo()

// Create a ContainerURL object that wraps a soon-to-be-created blob's URL and a default pipeline.
u, _ := url.Parse(fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/MyAppendBlob.txt", accountName))
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
	log.Fatal(err)
}
appendBlobURL := NewAppendBlobURL(*u, NewPipeline(credential, PipelineOptions{}))

ctx := context.Background() // This example uses a never-expiring context
_, err = appendBlobURL.Create(ctx, BlobHTTPHeaders{}, Metadata{}, BlobAccessConditions{}, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{})
if err != nil {
	log.Fatal(err)
}

for i := 0; i < 5; i++ { // Append 5 blocks to the append blob
	_, err := appendBlobURL.AppendBlock(ctx, strings.NewReader(fmt.Sprintf("Appending block #%d\n", i)), AppendBlobAccessConditions{}, nil, ClientProvidedKeyOptions{})
	if err != nil {
		log.Fatal(err)
	}
}

// Download the entire append blob's contents and show it.
get, err := appendBlobURL.Download(ctx, 0, 0, BlobAccessConditions{}, false, ClientProvidedKeyOptions{})
if err != nil {
	log.Fatal(err)
}
b := bytes.Buffer{}
reader := get.Body(RetryReaderOptions{})
b.ReadFrom(reader)
reader.Close() // The client must close the response body when finished with it
fmt.Println(b.String())
Output:

func NewAppendBlobURL

func NewAppendBlobURL(url url.URL, p pipeline.Pipeline) AppendBlobURL

NewAppendBlobURL creates an AppendBlobURL object using the specified URL and request policy pipeline.

func (AppendBlobURL) 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 (AppendBlobURL) AppendBlockFromURL

func (ab AppendBlobURL) AppendBlockFromURL(ctx context.Context, sourceURL url.URL, offset int64, count int64, destinationAccessConditions AppendBlobAccessConditions, sourceAccessConditions ModifiedAccessConditions, transactionalMD5 []byte, cpk ClientProvidedKeyOptions, sourceAuthorization TokenCredential) (*AppendBlobAppendBlockFromURLResponse, error)

AppendBlockFromURL copies a new block of data from source URL to the end of the existing append blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/append-block-from-url.

func (AppendBlobURL) Create

Create creates a 0-length 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 (AppendBlobURL) GetAccountInfo added in v0.9.0

func (ab AppendBlobURL) GetAccountInfo(ctx context.Context) (*BlobGetAccountInfoResponse, error)

func (AppendBlobURL) WithPipeline

func (ab AppendBlobURL) WithPipeline(p pipeline.Pipeline) AppendBlobURL

WithPipeline creates a new AppendBlobURL object identical to the source but with the specific request policy pipeline.

func (AppendBlobURL) WithSnapshot

func (ab AppendBlobURL) WithSnapshot(snapshot string) AppendBlobURL

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 (AppendBlobURL) WithVersionID added in v0.11.0

func (ab AppendBlobURL) WithVersionID(versionId string) AppendBlobURL

WithVersionID creates a new AppendBlobURL object identical to the source but with the specified version id. Pass "" to remove the snapshot returning a URL to the base blob.

type AppendPositionAccessConditions

type AppendPositionAccessConditions struct {
	// IfAppendPositionEqual ensures that the AppendBlock operation succeeds
	// only if the append position is equal to a value.
	// IfAppendPositionEqual=0 means no 'IfAppendPositionEqual' header specified.
	// IfAppendPositionEqual>0 means 'IfAppendPositionEqual' header specified with its value
	// IfAppendPositionEqual==-1 means IfAppendPositionEqual' header specified with a value of 0
	IfAppendPositionEqual int64

	// IfMaxSizeLessThanOrEqual ensures that the AppendBlock operation succeeds
	// only if the append blob's size is less than or equal to a value.
	// IfMaxSizeLessThanOrEqual=0 means no 'IfMaxSizeLessThanOrEqual' header specified.
	// IfMaxSizeLessThanOrEqual>0 means 'IfMaxSizeLessThanOrEqual' header specified with its value
	// IfMaxSizeLessThanOrEqual==-1 means 'IfMaxSizeLessThanOrEqual' header specified with a value of 0
	IfMaxSizeLessThanOrEqual int64
}

AppendPositionAccessConditions identifies append blob-specific access conditions which you optionally set.

type ArchiveStatusType

type ArchiveStatusType string

ArchiveStatusType enumerates the values for archive status type.

const (
	// ArchiveStatusNone represents an empty ArchiveStatusType.
	ArchiveStatusNone ArchiveStatusType = ""
	// ArchiveStatusRehydratePendingToCool ...
	ArchiveStatusRehydratePendingToCool ArchiveStatusType = "rehydrate-pending-to-cool"
	// ArchiveStatusRehydratePendingToHot ...
	ArchiveStatusRehydratePendingToHot ArchiveStatusType = "rehydrate-pending-to-hot"
)

func PossibleArchiveStatusTypeValues

func PossibleArchiveStatusTypeValues() []ArchiveStatusType

PossibleArchiveStatusTypeValues returns an array of possible values for the ArchiveStatusType const type.

type ArrowConfiguration added in v0.14.0

type ArrowConfiguration struct {
	Schema []ArrowField `xml:"Schema>Field"`
}

ArrowConfiguration - Groups the settings used for formatting the response if the response should be Arrow formatted.

type ArrowField added in v0.14.0

type ArrowField struct {
	// XMLName is used for marshalling and is subject to removal in a future release.
	XMLName   xml.Name `xml:"Field"`
	Type      string   `xml:"Type"`
	Name      *string  `xml:"Name"`
	Precision *int32   `xml:"Precision"`
	Scale     *int32   `xml:"Scale"`
}

ArrowField - Groups settings regarding specific field of an arrow schema

type BatchTransferOptions added in v0.8.0

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 BlobAbortCopyFromURLResponse

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

BlobAbortCopyFromURLResponse ...

func (BlobAbortCopyFromURLResponse) ClientRequestID added in v0.10.0

func (bacfur BlobAbortCopyFromURLResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobAbortCopyFromURLResponse) Date

func (bacfur BlobAbortCopyFromURLResponse) Date() time.Time

Date returns the value for header Date.

func (BlobAbortCopyFromURLResponse) ErrorCode

func (bacfur BlobAbortCopyFromURLResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobAbortCopyFromURLResponse) RequestID

func (bacfur BlobAbortCopyFromURLResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobAbortCopyFromURLResponse) Response

func (bacfur BlobAbortCopyFromURLResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobAbortCopyFromURLResponse) Status

func (bacfur BlobAbortCopyFromURLResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobAbortCopyFromURLResponse) StatusCode

func (bacfur BlobAbortCopyFromURLResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobAbortCopyFromURLResponse) Version

func (bacfur BlobAbortCopyFromURLResponse) Version() string

Version returns the value for header x-ms-version.

type BlobAccessConditions

type BlobAccessConditions struct {
	ModifiedAccessConditions
	LeaseAccessConditions
}

BlobAccessConditions identifies blob-specific access conditions which you optionally set.

Example

This example shows how to perform operations on blob conditionally.

// From the Azure portal, get your Storage account's name and account key.
accountName, accountKey := accountInfo()

// Create a BlockBlobURL object that wraps a blob's URL and a default pipeline.
u, _ := url.Parse(fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/Data.txt", accountName))
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
	log.Fatal(err)
}
blobURL := NewBlockBlobURL(*u, NewPipeline(credential, PipelineOptions{}))

ctx := context.Background() // This example uses a never-expiring context

// This helper function displays the results of an operation; it is called frequently below.
showResult := func(response pipeline.Response, err error) {
	if err != nil {
		if stgErr, ok := err.(StorageError); !ok {
			log.Fatal(err) // Network failure
		} else {
			fmt.Print("Failure: " + stgErr.Response().Status + "\n")
		}
	} else {
		if get, ok := response.(*DownloadResponse); ok {
			get.Body(RetryReaderOptions{}).Close() // The client must close the response body when finished with it
		}
		fmt.Print("Success: " + response.Response().Status + "\n")
	}
}

// Create the blob (unconditionally; succeeds)
upload, err := blobURL.Upload(ctx, strings.NewReader("Text-1"), BlobHTTPHeaders{}, Metadata{}, BlobAccessConditions{}, DefaultAccessTier, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{})
showResult(upload, err)

// Download blob content if the blob has been modified since we uploaded it (fails):
showResult(blobURL.Download(ctx, 0, 0, BlobAccessConditions{ModifiedAccessConditions: ModifiedAccessConditions{IfModifiedSince: upload.LastModified()}}, false, ClientProvidedKeyOptions{}))

// Download blob content if the blob hasn't been modified in the last 24 hours (fails):
showResult(blobURL.Download(ctx, 0, 0, BlobAccessConditions{ModifiedAccessConditions: ModifiedAccessConditions{IfUnmodifiedSince: time.Now().UTC().Add(time.Hour * -24)}}, false, ClientProvidedKeyOptions{}))

// Upload new content if the blob hasn't changed since the version identified by ETag (succeeds):
upload, err = blobURL.Upload(ctx, strings.NewReader("Text-2"), BlobHTTPHeaders{}, Metadata{}, BlobAccessConditions{ModifiedAccessConditions: ModifiedAccessConditions{IfMatch: upload.ETag()}}, DefaultAccessTier, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{})
showResult(upload, err)

// Download content if it has changed since the version identified by ETag (fails):
showResult(blobURL.Download(ctx, 0, 0, BlobAccessConditions{ModifiedAccessConditions: ModifiedAccessConditions{IfNoneMatch: upload.ETag()}}, false, ClientProvidedKeyOptions{}))

// Upload content if the blob doesn't already exist (fails):
showResult(blobURL.Upload(ctx, strings.NewReader("Text-3"), BlobHTTPHeaders{}, Metadata{}, BlobAccessConditions{ModifiedAccessConditions: ModifiedAccessConditions{IfNoneMatch: ETagAny}}, DefaultAccessTier, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{}))
Output:

type BlobAcquireLeaseResponse

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

BlobAcquireLeaseResponse ...

func (BlobAcquireLeaseResponse) ClientRequestID added in v0.10.0

func (balr BlobAcquireLeaseResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobAcquireLeaseResponse) Date

func (balr BlobAcquireLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (BlobAcquireLeaseResponse) ETag

func (balr BlobAcquireLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobAcquireLeaseResponse) ErrorCode

func (balr BlobAcquireLeaseResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobAcquireLeaseResponse) LastModified

func (balr BlobAcquireLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobAcquireLeaseResponse) LeaseID

func (balr BlobAcquireLeaseResponse) LeaseID() string

LeaseID returns the value for header x-ms-lease-id.

func (BlobAcquireLeaseResponse) RequestID

func (balr BlobAcquireLeaseResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobAcquireLeaseResponse) Response

func (balr BlobAcquireLeaseResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobAcquireLeaseResponse) Status

func (balr BlobAcquireLeaseResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobAcquireLeaseResponse) StatusCode

func (balr BlobAcquireLeaseResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobAcquireLeaseResponse) Version

func (balr BlobAcquireLeaseResponse) Version() string

Version returns the value for header x-ms-version.

type BlobBreakLeaseResponse

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

BlobBreakLeaseResponse ...

func (BlobBreakLeaseResponse) ClientRequestID added in v0.10.0

func (bblr BlobBreakLeaseResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobBreakLeaseResponse) Date

func (bblr BlobBreakLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (BlobBreakLeaseResponse) ETag

func (bblr BlobBreakLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobBreakLeaseResponse) ErrorCode

func (bblr BlobBreakLeaseResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobBreakLeaseResponse) LastModified

func (bblr BlobBreakLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobBreakLeaseResponse) LeaseTime

func (bblr BlobBreakLeaseResponse) LeaseTime() int32

LeaseTime returns the value for header x-ms-lease-time.

func (BlobBreakLeaseResponse) RequestID

func (bblr BlobBreakLeaseResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobBreakLeaseResponse) Response

func (bblr BlobBreakLeaseResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobBreakLeaseResponse) Status

func (bblr BlobBreakLeaseResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobBreakLeaseResponse) StatusCode

func (bblr BlobBreakLeaseResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobBreakLeaseResponse) Version

func (bblr BlobBreakLeaseResponse) Version() string

Version returns the value for header x-ms-version.

type BlobChangeLeaseResponse

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

BlobChangeLeaseResponse ...

func (BlobChangeLeaseResponse) ClientRequestID added in v0.10.0

func (bclr BlobChangeLeaseResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobChangeLeaseResponse) Date

func (bclr BlobChangeLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (BlobChangeLeaseResponse) ETag

func (bclr BlobChangeLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobChangeLeaseResponse) ErrorCode

func (bclr BlobChangeLeaseResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobChangeLeaseResponse) LastModified

func (bclr BlobChangeLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobChangeLeaseResponse) LeaseID

func (bclr BlobChangeLeaseResponse) LeaseID() string

LeaseID returns the value for header x-ms-lease-id.

func (BlobChangeLeaseResponse) RequestID

func (bclr BlobChangeLeaseResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobChangeLeaseResponse) Response

func (bclr BlobChangeLeaseResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobChangeLeaseResponse) Status

func (bclr BlobChangeLeaseResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobChangeLeaseResponse) StatusCode

func (bclr BlobChangeLeaseResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobChangeLeaseResponse) Version

func (bclr BlobChangeLeaseResponse) Version() string

Version returns the value for header x-ms-version.

type BlobCopyFromURLResponse added in v0.7.0

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

BlobCopyFromURLResponse ...

func (BlobCopyFromURLResponse) ClientRequestID added in v0.10.0

func (bcfur BlobCopyFromURLResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobCopyFromURLResponse) ContentMD5 added in v0.10.0

func (bcfur BlobCopyFromURLResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (BlobCopyFromURLResponse) CopyID added in v0.7.0

func (bcfur BlobCopyFromURLResponse) CopyID() string

CopyID returns the value for header x-ms-copy-id.

func (BlobCopyFromURLResponse) CopyStatus added in v0.7.0

func (bcfur BlobCopyFromURLResponse) CopyStatus() SyncCopyStatusType

CopyStatus returns the value for header x-ms-copy-status.

func (BlobCopyFromURLResponse) Date added in v0.7.0

func (bcfur BlobCopyFromURLResponse) Date() time.Time

Date returns the value for header Date.

func (BlobCopyFromURLResponse) ETag added in v0.7.0

func (bcfur BlobCopyFromURLResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobCopyFromURLResponse) ErrorCode added in v0.7.0

func (bcfur BlobCopyFromURLResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobCopyFromURLResponse) LastModified added in v0.7.0

func (bcfur BlobCopyFromURLResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobCopyFromURLResponse) RequestID added in v0.7.0

func (bcfur BlobCopyFromURLResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobCopyFromURLResponse) Response added in v0.7.0

func (bcfur BlobCopyFromURLResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobCopyFromURLResponse) Status added in v0.7.0

func (bcfur BlobCopyFromURLResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobCopyFromURLResponse) StatusCode added in v0.7.0

func (bcfur BlobCopyFromURLResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobCopyFromURLResponse) Version added in v0.7.0

func (bcfur BlobCopyFromURLResponse) Version() string

Version returns the value for header x-ms-version.

func (BlobCopyFromURLResponse) VersionID added in v0.11.0

func (bcfur BlobCopyFromURLResponse) VersionID() string

VersionID returns the value for header x-ms-version-id.

func (BlobCopyFromURLResponse) XMsContentCrc64 added in v0.10.0

func (bcfur BlobCopyFromURLResponse) XMsContentCrc64() []byte

XMsContentCrc64 returns the value for header x-ms-content-crc64.

type BlobCreateSnapshotResponse

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

BlobCreateSnapshotResponse ...

func (BlobCreateSnapshotResponse) ClientRequestID added in v0.10.0

func (bcsr BlobCreateSnapshotResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobCreateSnapshotResponse) Date

func (bcsr BlobCreateSnapshotResponse) Date() time.Time

Date returns the value for header Date.

func (BlobCreateSnapshotResponse) ETag

func (bcsr BlobCreateSnapshotResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobCreateSnapshotResponse) ErrorCode

func (bcsr BlobCreateSnapshotResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobCreateSnapshotResponse) IsServerEncrypted added in v0.10.0

func (bcsr BlobCreateSnapshotResponse) IsServerEncrypted() string

IsServerEncrypted returns the value for header x-ms-request-server-encrypted.

func (BlobCreateSnapshotResponse) LastModified

func (bcsr BlobCreateSnapshotResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobCreateSnapshotResponse) RequestID

func (bcsr BlobCreateSnapshotResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobCreateSnapshotResponse) Response

func (bcsr BlobCreateSnapshotResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobCreateSnapshotResponse) Snapshot

func (bcsr BlobCreateSnapshotResponse) Snapshot() string

Snapshot returns the value for header x-ms-snapshot.

func (BlobCreateSnapshotResponse) Status

func (bcsr BlobCreateSnapshotResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobCreateSnapshotResponse) StatusCode

func (bcsr BlobCreateSnapshotResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobCreateSnapshotResponse) Version

func (bcsr BlobCreateSnapshotResponse) Version() string

Version returns the value for header x-ms-version.

func (BlobCreateSnapshotResponse) VersionID added in v0.11.0

func (bcsr BlobCreateSnapshotResponse) VersionID() string

VersionID returns the value for header x-ms-version-id.

type BlobDeleteImmutabilityPolicyResponse added in v0.15.0

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

BlobDeleteImmutabilityPolicyResponse ...

func (BlobDeleteImmutabilityPolicyResponse) ClientRequestID added in v0.15.0

func (bdipr BlobDeleteImmutabilityPolicyResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobDeleteImmutabilityPolicyResponse) Date added in v0.15.0

Date returns the value for header Date.

func (BlobDeleteImmutabilityPolicyResponse) ErrorCode added in v0.15.0

func (bdipr BlobDeleteImmutabilityPolicyResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobDeleteImmutabilityPolicyResponse) RequestID added in v0.15.0

func (bdipr BlobDeleteImmutabilityPolicyResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobDeleteImmutabilityPolicyResponse) Response added in v0.15.0

Response returns the raw HTTP response object.

func (BlobDeleteImmutabilityPolicyResponse) Status added in v0.15.0

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobDeleteImmutabilityPolicyResponse) StatusCode added in v0.15.0

func (bdipr BlobDeleteImmutabilityPolicyResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobDeleteImmutabilityPolicyResponse) Version added in v0.15.0

Version returns the value for header x-ms-version.

type BlobDeleteResponse

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

BlobDeleteResponse ...

func (BlobDeleteResponse) ClientRequestID added in v0.10.0

func (bdr BlobDeleteResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobDeleteResponse) Date

func (bdr BlobDeleteResponse) Date() time.Time

Date returns the value for header Date.

func (BlobDeleteResponse) ErrorCode

func (bdr BlobDeleteResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobDeleteResponse) RequestID

func (bdr BlobDeleteResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobDeleteResponse) Response

func (bdr BlobDeleteResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobDeleteResponse) Status

func (bdr BlobDeleteResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobDeleteResponse) StatusCode

func (bdr BlobDeleteResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobDeleteResponse) Version

func (bdr BlobDeleteResponse) Version() string

Version returns the value for header x-ms-version.

type BlobDeleteType added in v0.14.0

type BlobDeleteType string

BlobDeleteType enumerates the values for blob delete type.

const (
	// BlobDeleteNone represents an empty BlobDeleteType.
	BlobDeleteNone BlobDeleteType = ""
	// BlobDeletePermanent ...
	BlobDeletePermanent BlobDeleteType = "Permanent"
)

func PossibleBlobDeleteTypeValues added in v0.14.0

func PossibleBlobDeleteTypeValues() []BlobDeleteType

PossibleBlobDeleteTypeValues returns an array of possible values for the BlobDeleteType const type.

type BlobExpiryOptionsType added in v0.11.0

type BlobExpiryOptionsType string

BlobExpiryOptionsType enumerates the values for blob expiry options type.

const (
	// BlobExpiryOptionsAbsolute ...
	BlobExpiryOptionsAbsolute BlobExpiryOptionsType = "Absolute"
	// BlobExpiryOptionsNeverExpire ...
	BlobExpiryOptionsNeverExpire BlobExpiryOptionsType = "NeverExpire"
	// BlobExpiryOptionsNone represents an empty BlobExpiryOptionsType.
	BlobExpiryOptionsNone BlobExpiryOptionsType = ""
	// BlobExpiryOptionsRelativeToCreation ...
	BlobExpiryOptionsRelativeToCreation BlobExpiryOptionsType = "RelativeToCreation"
	// BlobExpiryOptionsRelativeToNow ...
	BlobExpiryOptionsRelativeToNow BlobExpiryOptionsType = "RelativeToNow"
)

func PossibleBlobExpiryOptionsTypeValues added in v0.11.0

func PossibleBlobExpiryOptionsTypeValues() []BlobExpiryOptionsType

PossibleBlobExpiryOptionsTypeValues returns an array of possible values for the BlobExpiryOptionsType const type.

type BlobFlatListSegment

type BlobFlatListSegment struct {
	// XMLName is used for marshalling and is subject to removal in a future release.
	XMLName   xml.Name           `xml:"Blobs"`
	BlobItems []BlobItemInternal `xml:"Blob"`
}

BlobFlatListSegment ...

type BlobGetAccountInfoResponse

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

BlobGetAccountInfoResponse ...

func (BlobGetAccountInfoResponse) AccountKind

func (bgair BlobGetAccountInfoResponse) AccountKind() AccountKindType

AccountKind returns the value for header x-ms-account-kind.

func (BlobGetAccountInfoResponse) ClientRequestID added in v0.10.0

func (bgair BlobGetAccountInfoResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobGetAccountInfoResponse) Date

func (bgair BlobGetAccountInfoResponse) Date() time.Time

Date returns the value for header Date.

func (BlobGetAccountInfoResponse) ErrorCode

func (bgair BlobGetAccountInfoResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobGetAccountInfoResponse) RequestID

func (bgair BlobGetAccountInfoResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobGetAccountInfoResponse) Response

func (bgair BlobGetAccountInfoResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobGetAccountInfoResponse) SkuName

func (bgair BlobGetAccountInfoResponse) SkuName() SkuNameType

SkuName returns the value for header x-ms-sku-name.

func (BlobGetAccountInfoResponse) Status

func (bgair BlobGetAccountInfoResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobGetAccountInfoResponse) StatusCode

func (bgair BlobGetAccountInfoResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobGetAccountInfoResponse) Version

func (bgair BlobGetAccountInfoResponse) Version() string

Version returns the value for header x-ms-version.

type BlobGetPropertiesResponse

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

BlobGetPropertiesResponse ...

func (BlobGetPropertiesResponse) AcceptRanges

func (bgpr BlobGetPropertiesResponse) AcceptRanges() string

AcceptRanges returns the value for header Accept-Ranges.

func (BlobGetPropertiesResponse) AccessTier

func (bgpr BlobGetPropertiesResponse) AccessTier() string

AccessTier returns the value for header x-ms-access-tier.

func (BlobGetPropertiesResponse) AccessTierChangeTime

func (bgpr BlobGetPropertiesResponse) AccessTierChangeTime() time.Time

AccessTierChangeTime returns the value for header x-ms-access-tier-change-time.

func (BlobGetPropertiesResponse) AccessTierInferred

func (bgpr BlobGetPropertiesResponse) AccessTierInferred() string

AccessTierInferred returns the value for header x-ms-access-tier-inferred.

func (BlobGetPropertiesResponse) ArchiveStatus

func (bgpr BlobGetPropertiesResponse) ArchiveStatus() string

ArchiveStatus returns the value for header x-ms-archive-status.

func (BlobGetPropertiesResponse) BlobCommittedBlockCount

func (bgpr BlobGetPropertiesResponse) BlobCommittedBlockCount() int32

BlobCommittedBlockCount returns the value for header x-ms-blob-committed-block-count.

func (BlobGetPropertiesResponse) BlobSequenceNumber

func (bgpr BlobGetPropertiesResponse) BlobSequenceNumber() int64

BlobSequenceNumber returns the value for header x-ms-blob-sequence-number.

func (BlobGetPropertiesResponse) BlobType

func (bgpr BlobGetPropertiesResponse) BlobType() BlobType

BlobType returns the value for header x-ms-blob-type.

func (BlobGetPropertiesResponse) CacheControl

func (bgpr BlobGetPropertiesResponse) CacheControl() string

CacheControl returns the value for header Cache-Control.

func (BlobGetPropertiesResponse) ClientRequestID added in v0.10.0

func (bgpr BlobGetPropertiesResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobGetPropertiesResponse) ContentDisposition

func (bgpr BlobGetPropertiesResponse) ContentDisposition() string

ContentDisposition returns the value for header Content-Disposition.

func (BlobGetPropertiesResponse) ContentEncoding

func (bgpr BlobGetPropertiesResponse) ContentEncoding() string

ContentEncoding returns the value for header Content-Encoding.

func (BlobGetPropertiesResponse) ContentLanguage

func (bgpr BlobGetPropertiesResponse) ContentLanguage() string

ContentLanguage returns the value for header Content-Language.

func (BlobGetPropertiesResponse) ContentLength

func (bgpr BlobGetPropertiesResponse) ContentLength() int64

ContentLength returns the value for header Content-Length.

func (BlobGetPropertiesResponse) ContentMD5

func (bgpr BlobGetPropertiesResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (BlobGetPropertiesResponse) ContentType

func (bgpr BlobGetPropertiesResponse) ContentType() string

ContentType returns the value for header Content-Type.

func (BlobGetPropertiesResponse) CopyCompletionTime

func (bgpr BlobGetPropertiesResponse) CopyCompletionTime() time.Time

CopyCompletionTime returns the value for header x-ms-copy-completion-time.

func (BlobGetPropertiesResponse) CopyID

func (bgpr BlobGetPropertiesResponse) CopyID() string

CopyID returns the value for header x-ms-copy-id.

func (BlobGetPropertiesResponse) CopyProgress

func (bgpr BlobGetPropertiesResponse) CopyProgress() string

CopyProgress returns the value for header x-ms-copy-progress.

func (BlobGetPropertiesResponse) CopySource

func (bgpr BlobGetPropertiesResponse) CopySource() string

CopySource returns the value for header x-ms-copy-source.

func (BlobGetPropertiesResponse) CopyStatus

func (bgpr BlobGetPropertiesResponse) CopyStatus() CopyStatusType

CopyStatus returns the value for header x-ms-copy-status.

func (BlobGetPropertiesResponse) CopyStatusDescription

func (bgpr BlobGetPropertiesResponse) CopyStatusDescription() string

CopyStatusDescription returns the value for header x-ms-copy-status-description.

func (BlobGetPropertiesResponse) CreationTime

func (bgpr BlobGetPropertiesResponse) CreationTime() time.Time

CreationTime returns the value for header x-ms-creation-time.

func (BlobGetPropertiesResponse) Date

func (bgpr BlobGetPropertiesResponse) Date() time.Time

Date returns the value for header Date.

func (BlobGetPropertiesResponse) DestinationSnapshot

func (bgpr BlobGetPropertiesResponse) DestinationSnapshot() string

DestinationSnapshot returns the value for header x-ms-copy-destination-snapshot.

func (BlobGetPropertiesResponse) ETag

func (bgpr BlobGetPropertiesResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobGetPropertiesResponse) EncryptionKeySha256 added in v0.10.0

func (bgpr BlobGetPropertiesResponse) EncryptionKeySha256() string

EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256.

func (BlobGetPropertiesResponse) EncryptionScope added in v0.11.0

func (bgpr BlobGetPropertiesResponse) EncryptionScope() string

EncryptionScope returns the value for header x-ms-encryption-scope.

func (BlobGetPropertiesResponse) ErrorCode

func (bgpr BlobGetPropertiesResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobGetPropertiesResponse) ExpiresOn added in v0.11.0

func (bgpr BlobGetPropertiesResponse) ExpiresOn() time.Time

ExpiresOn returns the value for header x-ms-expiry-time.

func (BlobGetPropertiesResponse) ImmutabilityPolicyExpiresOn added in v0.15.0

func (bgpr BlobGetPropertiesResponse) ImmutabilityPolicyExpiresOn() time.Time

ImmutabilityPolicyExpiresOn returns the value for header x-ms-immutability-policy-until-date.

func (BlobGetPropertiesResponse) ImmutabilityPolicyMode added in v0.15.0

func (bgpr BlobGetPropertiesResponse) ImmutabilityPolicyMode() BlobImmutabilityPolicyModeType

ImmutabilityPolicyMode returns the value for header x-ms-immutability-policy-mode.

func (BlobGetPropertiesResponse) IsCurrentVersion added in v0.11.0

func (bgpr BlobGetPropertiesResponse) IsCurrentVersion() string

IsCurrentVersion returns the value for header x-ms-is-current-version.

func (BlobGetPropertiesResponse) IsIncrementalCopy

func (bgpr BlobGetPropertiesResponse) IsIncrementalCopy() string

IsIncrementalCopy returns the value for header x-ms-incremental-copy.

func (BlobGetPropertiesResponse) IsSealed added in v0.11.0

func (bgpr BlobGetPropertiesResponse) IsSealed() string

IsSealed returns the value for header x-ms-blob-sealed.

func (BlobGetPropertiesResponse) IsServerEncrypted

func (bgpr BlobGetPropertiesResponse) IsServerEncrypted() string

IsServerEncrypted returns the value for header x-ms-server-encrypted.

func (BlobGetPropertiesResponse) LastAccessed added in v0.14.0

func (bgpr BlobGetPropertiesResponse) LastAccessed() time.Time

LastAccessed returns the value for header x-ms-last-access-time.

func (BlobGetPropertiesResponse) LastModified

func (bgpr BlobGetPropertiesResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobGetPropertiesResponse) LeaseDuration

func (bgpr BlobGetPropertiesResponse) LeaseDuration() LeaseDurationType

LeaseDuration returns the value for header x-ms-lease-duration.

func (BlobGetPropertiesResponse) LeaseState

func (bgpr BlobGetPropertiesResponse) LeaseState() LeaseStateType

LeaseState returns the value for header x-ms-lease-state.

func (BlobGetPropertiesResponse) LeaseStatus

func (bgpr BlobGetPropertiesResponse) LeaseStatus() LeaseStatusType

LeaseStatus returns the value for header x-ms-lease-status.

func (BlobGetPropertiesResponse) LegalHold added in v0.15.0

func (bgpr BlobGetPropertiesResponse) LegalHold() string

LegalHold returns the value for header x-ms-legal-hold.

func (BlobGetPropertiesResponse) NewHTTPHeaders

func (bgpr BlobGetPropertiesResponse) NewHTTPHeaders() BlobHTTPHeaders

NewHTTPHeaders returns the user-modifiable properties for this blob.

func (BlobGetPropertiesResponse) NewMetadata

func (bgpr BlobGetPropertiesResponse) NewMetadata() Metadata

NewMetadata returns user-defined key/value pairs.

func (BlobGetPropertiesResponse) ObjectReplicationPolicyID added in v0.11.0

func (bgpr BlobGetPropertiesResponse) ObjectReplicationPolicyID() string

ObjectReplicationPolicyID returns the value for header x-ms-or-policy-id.

func (BlobGetPropertiesResponse) ObjectReplicationRules added in v0.11.0

func (bgpr BlobGetPropertiesResponse) ObjectReplicationRules() string

ObjectReplicationRules returns the value for header x-ms-or.

func (BlobGetPropertiesResponse) RehydratePriority added in v0.11.0

func (bgpr BlobGetPropertiesResponse) RehydratePriority() string

RehydratePriority returns the value for header x-ms-rehydrate-priority.

func (BlobGetPropertiesResponse) RequestID

func (bgpr BlobGetPropertiesResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobGetPropertiesResponse) Response

func (bgpr BlobGetPropertiesResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobGetPropertiesResponse) Status

func (bgpr BlobGetPropertiesResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobGetPropertiesResponse) StatusCode

func (bgpr BlobGetPropertiesResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobGetPropertiesResponse) TagCount added in v0.11.0

func (bgpr BlobGetPropertiesResponse) TagCount() int64

TagCount returns the value for header x-ms-tag-count.

func (BlobGetPropertiesResponse) Version

func (bgpr BlobGetPropertiesResponse) Version() string

Version returns the value for header x-ms-version.

func (BlobGetPropertiesResponse) VersionID added in v0.11.0

func (bgpr BlobGetPropertiesResponse) VersionID() string

VersionID returns the value for header x-ms-version-id.

type BlobHTTPHeaders

type BlobHTTPHeaders struct {
	ContentType        string
	ContentMD5         []byte
	ContentEncoding    string
	ContentLanguage    string
	ContentDisposition string
	CacheControl       string
}

BlobHTTPHeaders contains read/writeable blob properties.

Example

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

// From the Azure portal, get your Storage account blob service URL endpoint.
accountName, accountKey := accountInfo()

// Create a ContainerURL object that wraps a soon-to-be-created blob's URL and a default pipeline.
u, _ := url.Parse(fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/ReadMe.txt", accountName))
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
	log.Fatal(err)
}
blobURL := NewBlockBlobURL(*u, NewPipeline(credential, PipelineOptions{}))

ctx := context.Background() // This example uses a never-expiring context

// Create a blob with HTTP headers
_, err = blobURL.Upload(ctx, strings.NewReader("Some text"), BlobHTTPHeaders{
	ContentType:        "text/html; charset=utf-8",
	ContentDisposition: "attachment",
}, Metadata{}, BlobAccessConditions{}, DefaultAccessTier, nil, ClientProvidedKeyOptions{}, ImmutabilityPolicyOptions{})
if err != nil {
	log.Fatal(err)
}

// GetMetadata returns the blob's properties, HTTP headers, and metadata
get, err := blobURL.GetProperties(ctx, BlobAccessConditions{}, ClientProvidedKeyOptions{})
if err != nil {
	log.Fatal(err)
}

// Show some of the blob's read-only properties
fmt.Println(get.BlobType(), get.ETag(), get.LastModified())

// Shows some of the blob's HTTP Headers
httpHeaders := get.NewHTTPHeaders()
fmt.Println(httpHeaders.ContentType, httpHeaders.ContentDisposition)

// Update the blob's HTTP Headers and write them back to the blob
httpHeaders.ContentType = "text/plain"
_, err = blobURL.SetHTTPHeaders(ctx, httpHeaders, BlobAccessConditions{})
if err != nil {
	log.Fatal(err)
}

// NOTE: The SetMetadata method updates the blob's ETag & LastModified properties
Output:

type BlobHierarchyListSegment

type BlobHierarchyListSegment struct {
	// XMLName is used for marshalling and is subject to removal in a future release.
	XMLName      xml.Name           `xml:"Blobs"`
	BlobPrefixes []BlobPrefix       `xml:"BlobPrefix"`
	BlobItems    []BlobItemInternal `xml:"Blob"`
}

BlobHierarchyListSegment ...

type BlobImmutabilityPolicyModeType added in v0.15.0

type BlobImmutabilityPolicyModeType string

BlobImmutabilityPolicyModeType enumerates the values for blob immutability policy mode type.

const (
	// BlobImmutabilityPolicyModeLocked ...
	BlobImmutabilityPolicyModeLocked BlobImmutabilityPolicyModeType = "locked"
	// BlobImmutabilityPolicyModeMutable ...
	BlobImmutabilityPolicyModeMutable BlobImmutabilityPolicyModeType = "mutable"
	// BlobImmutabilityPolicyModeNone represents an empty BlobImmutabilityPolicyModeType.
	BlobImmutabilityPolicyModeNone BlobImmutabilityPolicyModeType = ""
	// BlobImmutabilityPolicyModeUnlocked ...
	BlobImmutabilityPolicyModeUnlocked BlobImmutabilityPolicyModeType = "unlocked"
)

func PossibleBlobImmutabilityPolicyModeTypeValues added in v0.15.0

func PossibleBlobImmutabilityPolicyModeTypeValues() []BlobImmutabilityPolicyModeType

PossibleBlobImmutabilityPolicyModeTypeValues returns an array of possible values for the BlobImmutabilityPolicyModeType const type.

type BlobItemInternal added in v0.11.0

type BlobItemInternal struct {
	// XMLName is used for marshalling and is subject to removal in a future release.
	XMLName                   xml.Name               `xml:"Blob"`
	Name                      string                 `xml:"Name"`
	Deleted                   bool                   `xml:"Deleted"`
	Snapshot                  string                 `xml:"Snapshot"`
	VersionID                 *string                `xml:"VersionId"`
	IsCurrentVersion          *bool                  `xml:"IsCurrentVersion"`
	Properties                BlobPropertiesInternal `xml:"Properties"`
	Metadata                  Metadata               `xml:"Metadata"`
	BlobTags                  *BlobTags              `xml:"Tags"`
	ObjectReplicationMetadata map[string]string      `xml:"ObjectReplicationMetadata"`
	HasVersionsOnly           *bool                  `xml:"HasVersionsOnly"`
}

BlobItemInternal - An Azure Storage blob

type BlobListingDetails

type BlobListingDetails struct {
	Copy, Metadata, Snapshots, UncommittedBlobs, Deleted, Tags, Versions, Permissions, LegalHold, ImmutabilityPolicy, DeletedWithVersions bool
}

BlobListingDetails indicates what additional information the service should return with each blob.

type BlobPrefix

type BlobPrefix struct {
	Name string `xml:"Name"`
}

BlobPrefix ...

type BlobPropertiesInternal added in v0.15.0

type BlobPropertiesInternal struct {
	// XMLName is used for marshalling and is subject to removal in a future release.
	XMLName      xml.Name   `xml:"Properties"`
	CreationTime *time.Time `xml:"Creation-Time"`
	LastModified time.Time  `xml:"Last-Modified"`
	Etag         ETag       `xml:"Etag"`
	// ContentLength - Size in bytes
	ContentLength      *int64  `xml:"Content-Length"`
	ContentType        *string `xml:"Content-Type"`
	ContentEncoding    *string `xml:"Content-Encoding"`
	ContentLanguage    *string `xml:"Content-Language"`
	ContentMD5         []byte  `xml:"Content-MD5"`
	ContentDisposition *string `xml:"Content-Disposition"`
	CacheControl       *string `xml:"Cache-Control"`
	BlobSequenceNumber *int64  `xml:"x-ms-blob-sequence-number"`
	// BlobType - Possible values include: 'BlobBlockBlob', 'BlobPageBlob', 'BlobAppendBlob', 'BlobNone'
	BlobType BlobType `xml:"BlobType"`
	// LeaseStatus - Possible values include: 'LeaseStatusLocked', 'LeaseStatusUnlocked', 'LeaseStatusNone'
	LeaseStatus LeaseStatusType `xml:"LeaseStatus"`
	// LeaseState - Possible values include: 'LeaseStateAvailable', 'LeaseStateLeased', 'LeaseStateExpired', 'LeaseStateBreaking', 'LeaseStateBroken', 'LeaseStateNone'
	LeaseState LeaseStateType `xml:"LeaseState"`
	// LeaseDuration - Possible values include: 'LeaseDurationInfinite', 'LeaseDurationFixed', 'LeaseDurationNone'
	LeaseDuration LeaseDurationType `xml:"LeaseDuration"`
	CopyID        *string           `xml:"CopyId"`
	// CopyStatus - Possible values include: 'CopyStatusPending', 'CopyStatusSuccess', 'CopyStatusAborted', 'CopyStatusFailed', 'CopyStatusNone'
	CopyStatus             CopyStatusType `xml:"CopyStatus"`
	CopySource             *string        `xml:"CopySource"`
	CopyProgress           *string        `xml:"CopyProgress"`
	CopyCompletionTime     *time.Time     `xml:"CopyCompletionTime"`
	CopyStatusDescription  *string        `xml:"CopyStatusDescription"`
	ServerEncrypted        *bool          `xml:"ServerEncrypted"`
	IncrementalCopy        *bool          `xml:"IncrementalCopy"`
	DestinationSnapshot    *string        `xml:"DestinationSnapshot"`
	DeletedTime            *time.Time     `xml:"DeletedTime"`
	RemainingRetentionDays *int32         `xml:"RemainingRetentionDays"`
	// AccessTier - Possible values include: 'AccessTierP4', 'AccessTierP6', 'AccessTierP10', 'AccessTierP15', 'AccessTierP20', 'AccessTierP30', 'AccessTierP40', 'AccessTierP50', 'AccessTierP60', 'AccessTierP70', 'AccessTierP80', 'AccessTierHot', 'AccessTierCool', 'AccessTierArchive', 'AccessTierNone'
	AccessTier         AccessTierType `xml:"AccessTier"`
	AccessTierInferred *bool          `xml:"AccessTierInferred"`
	// ArchiveStatus - Possible values include: 'ArchiveStatusRehydratePendingToHot', 'ArchiveStatusRehydratePendingToCool', 'ArchiveStatusNone'
	ArchiveStatus             ArchiveStatusType `xml:"ArchiveStatus"`
	CustomerProvidedKeySha256 *string           `xml:"CustomerProvidedKeySha256"`
	// EncryptionScope - The name of the encryption scope under which the blob is encrypted.
	EncryptionScope      *string    `xml:"EncryptionScope"`
	AccessTierChangeTime *time.Time `xml:"AccessTierChangeTime"`
	TagCount             *int32     `xml:"TagCount"`
	ExpiresOn            *time.Time `xml:"Expiry-Time"`
	IsSealed             *bool      `xml:"Sealed"`
	// RehydratePriority - Possible values include: 'RehydratePriorityHigh', 'RehydratePriorityStandard', 'RehydratePriorityNone'
	RehydratePriority           RehydratePriorityType `xml:"RehydratePriority"`
	LastAccessedOn              *time.Time            `xml:"LastAccessTime"`
	ImmutabilityPolicyExpiresOn *time.Time            `xml:"ImmutabilityPolicyUntilDate"`
	// ImmutabilityPolicyMode - Possible values include: 'BlobImmutabilityPolicyModeMutable', 'BlobImmutabilityPolicyModeUnlocked', 'BlobImmutabilityPolicyModeLocked', 'BlobImmutabilityPolicyModeNone'
	ImmutabilityPolicyMode BlobImmutabilityPolicyModeType `xml:"ImmutabilityPolicyMode"`
	LegalHold              *bool                          `xml:"LegalHold"`
	Owner                  *string                        `xml:"Owner"`
	Group                  *string                        `xml:"Group"`
	Permissions            *string                        `xml:"Permissions"`
	ACL                    *string                        `xml:"Acl"`
}

BlobPropertiesInternal - Properties of a blob

func (BlobPropertiesInternal) MarshalXML added in v0.15.0

func (bpi BlobPropertiesInternal) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for BlobPropertiesInternal.

func (*BlobPropertiesInternal) UnmarshalXML added in v0.15.0

func (bpi *BlobPropertiesInternal) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements the xml.Unmarshaler interface for BlobPropertiesInternal.

type BlobReleaseLeaseResponse

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

BlobReleaseLeaseResponse ...

func (BlobReleaseLeaseResponse) ClientRequestID added in v0.10.0

func (brlr BlobReleaseLeaseResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobReleaseLeaseResponse) Date

func (brlr BlobReleaseLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (BlobReleaseLeaseResponse) ETag

func (brlr BlobReleaseLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobReleaseLeaseResponse) ErrorCode

func (brlr BlobReleaseLeaseResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobReleaseLeaseResponse) LastModified

func (brlr BlobReleaseLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobReleaseLeaseResponse) RequestID

func (brlr BlobReleaseLeaseResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobReleaseLeaseResponse) Response

func (brlr BlobReleaseLeaseResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobReleaseLeaseResponse) Status

func (brlr BlobReleaseLeaseResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobReleaseLeaseResponse) StatusCode

func (brlr BlobReleaseLeaseResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobReleaseLeaseResponse) Version

func (brlr BlobReleaseLeaseResponse) Version() string

Version returns the value for header x-ms-version.

type BlobRenewLeaseResponse

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

BlobRenewLeaseResponse ...

func (BlobRenewLeaseResponse) ClientRequestID added in v0.10.0

func (brlr BlobRenewLeaseResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobRenewLeaseResponse) Date

func (brlr BlobRenewLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (BlobRenewLeaseResponse) ETag

func (brlr BlobRenewLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobRenewLeaseResponse) ErrorCode

func (brlr BlobRenewLeaseResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobRenewLeaseResponse) LastModified

func (brlr BlobRenewLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobRenewLeaseResponse) LeaseID

func (brlr BlobRenewLeaseResponse) LeaseID() string

LeaseID returns the value for header x-ms-lease-id.

func (BlobRenewLeaseResponse) RequestID

func (brlr BlobRenewLeaseResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobRenewLeaseResponse) Response

func (brlr BlobRenewLeaseResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobRenewLeaseResponse) Status

func (brlr BlobRenewLeaseResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobRenewLeaseResponse) StatusCode

func (brlr BlobRenewLeaseResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobRenewLeaseResponse) Version

func (brlr BlobRenewLeaseResponse) Version() string

Version returns the value for header x-ms-version.

type BlobSASPermissions

type BlobSASPermissions struct {
	Read, Add, Create, Write, Delete, DeletePreviousVersion, Tag, List, Move, Execute, Ownership, Permissions, PermanentDelete, Immutability 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 shows how to create and use a Blob Service Shared Access Signature (SAS).

// From the Azure portal, get your Storage account's name and account key.
accountName, accountKey := accountInfo()

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

// This is the name of the container and blob that we're creating a SAS to.
containerName := "mycontainer" // Container names require lowercase
blobName := "HelloWorld.txt"   // Blob names can be mixed case

// Set the desired SAS signature values and sign them with the shared key credentials to get the SAS query parameters.
sasQueryParams, err := BlobSASSignatureValues{
	Protocol:      SASProtocolHTTPS,                     // Users MUST use HTTPS (not HTTP)
	ExpiryTime:    time.Now().UTC().Add(48 * time.Hour), // 48-hours before expiration
	ContainerName: containerName,
	BlobName:      blobName,

	// To produce a container SAS (as opposed to a blob SAS), assign to Permissions using
	// ContainerSASPermissions and make sure the BlobName field is "" (the default).
	Permissions: BlobSASPermissions{Add: true, Read: true, Write: true}.String(),
}.NewSASQueryParameters(credential)
if err != nil {
	log.Fatal(err)
}

// Create the URL of the resource you wish to access and append the SAS query parameters.
// Since this is a blob SAS, the URL is to the Azure storage blob.
qp := sasQueryParams.Encode()
urlToSendToSomeone := fmt.Sprintf("https://%s.blob.core.windows.net/%s/%s?%s",
	accountName, containerName, blobName, qp)
// At this point, you can send the urlToSendToSomeone to someone via email or any other mechanism you choose.

// ************************************************************************************************

// When someone receives the URL, they access the SAS-protected resource with code like this:
u, _ := url.Parse(urlToSendToSomeone)

// Create an BlobURL object that wraps the blob URL (and its SAS) and a pipeline.
// When using a SAS URLs, anonymous credentials are required.
blobURL := NewBlobURL(*u, NewPipeline(NewAnonymousCredential(), PipelineOptions{}))
// Now, you can use this blobURL just like any other to make requests of the resource.

// If you have a SAS query parameter string, you can parse it into its parts:
blobURLParts := NewBlobURLParts(blobURL.URL())
fmt.Printf("SAS expiry time=%v", blobURLParts.SAS.ExpiryTime())

_ = blobURL // Avoid compiler's "declared and not used" error
Output:

func (BlobSASSignatureValues) NewSASQueryParameters

func (v BlobSASSignatureValues) NewSASQueryParameters(credential StorageAccountCredential) (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 BlobSetExpiryResponse added in v0.11.0

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

BlobSetExpiryResponse ...

func (BlobSetExpiryResponse) ClientRequestID added in v0.11.0

func (bser BlobSetExpiryResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobSetExpiryResponse) Date added in v0.11.0

func (bser BlobSetExpiryResponse) Date() time.Time

Date returns the value for header Date.

func (BlobSetExpiryResponse) ETag added in v0.11.0

func (bser BlobSetExpiryResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobSetExpiryResponse) ErrorCode added in v0.11.0

func (bser BlobSetExpiryResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobSetExpiryResponse) LastModified added in v0.11.0

func (bser BlobSetExpiryResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobSetExpiryResponse) RequestID added in v0.11.0

func (bser BlobSetExpiryResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobSetExpiryResponse) Response added in v0.11.0

func (bser BlobSetExpiryResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobSetExpiryResponse) Status added in v0.11.0

func (bser BlobSetExpiryResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobSetExpiryResponse) StatusCode added in v0.11.0

func (bser BlobSetExpiryResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobSetExpiryResponse) Version added in v0.11.0

func (bser BlobSetExpiryResponse) Version() string

Version returns the value for header x-ms-version.

type BlobSetHTTPHeadersResponse

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

BlobSetHTTPHeadersResponse ...

func (BlobSetHTTPHeadersResponse) BlobSequenceNumber

func (bshhr BlobSetHTTPHeadersResponse) BlobSequenceNumber() int64

BlobSequenceNumber returns the value for header x-ms-blob-sequence-number.

func (BlobSetHTTPHeadersResponse) ClientRequestID added in v0.10.0

func (bshhr BlobSetHTTPHeadersResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobSetHTTPHeadersResponse) Date

func (bshhr BlobSetHTTPHeadersResponse) Date() time.Time

Date returns the value for header Date.

func (BlobSetHTTPHeadersResponse) ETag

func (bshhr BlobSetHTTPHeadersResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobSetHTTPHeadersResponse) ErrorCode

func (bshhr BlobSetHTTPHeadersResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobSetHTTPHeadersResponse) LastModified

func (bshhr BlobSetHTTPHeadersResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobSetHTTPHeadersResponse) RequestID

func (bshhr BlobSetHTTPHeadersResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobSetHTTPHeadersResponse) Response

func (bshhr BlobSetHTTPHeadersResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobSetHTTPHeadersResponse) Status

func (bshhr BlobSetHTTPHeadersResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobSetHTTPHeadersResponse) StatusCode

func (bshhr BlobSetHTTPHeadersResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobSetHTTPHeadersResponse) Version

func (bshhr BlobSetHTTPHeadersResponse) Version() string

Version returns the value for header x-ms-version.

type BlobSetImmutabilityPolicyResponse added in v0.15.0

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

BlobSetImmutabilityPolicyResponse ...

func (BlobSetImmutabilityPolicyResponse) ClientRequestID added in v0.15.0

func (bsipr BlobSetImmutabilityPolicyResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobSetImmutabilityPolicyResponse) Date added in v0.15.0

Date returns the value for header Date.

func (BlobSetImmutabilityPolicyResponse) ErrorCode added in v0.15.0

func (bsipr BlobSetImmutabilityPolicyResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobSetImmutabilityPolicyResponse) ImmutabilityPolicyExpiry added in v0.15.0

func (bsipr BlobSetImmutabilityPolicyResponse) ImmutabilityPolicyExpiry() time.Time

ImmutabilityPolicyExpiry returns the value for header x-ms-immutability-policy-until-date.

func (BlobSetImmutabilityPolicyResponse) ImmutabilityPolicyMode added in v0.15.0

ImmutabilityPolicyMode returns the value for header x-ms-immutability-policy-mode.

func (BlobSetImmutabilityPolicyResponse) RequestID added in v0.15.0

func (bsipr BlobSetImmutabilityPolicyResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobSetImmutabilityPolicyResponse) Response added in v0.15.0

Response returns the raw HTTP response object.

func (BlobSetImmutabilityPolicyResponse) Status added in v0.15.0

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobSetImmutabilityPolicyResponse) StatusCode added in v0.15.0

func (bsipr BlobSetImmutabilityPolicyResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobSetImmutabilityPolicyResponse) Version added in v0.15.0

func (bsipr BlobSetImmutabilityPolicyResponse) Version() string

Version returns the value for header x-ms-version.

type BlobSetLegalHoldResponse added in v0.15.0

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

BlobSetLegalHoldResponse ...

func (BlobSetLegalHoldResponse) ClientRequestID added in v0.15.0

func (bslhr BlobSetLegalHoldResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobSetLegalHoldResponse) Date added in v0.15.0

func (bslhr BlobSetLegalHoldResponse) Date() time.Time

Date returns the value for header Date.

func (BlobSetLegalHoldResponse) ErrorCode added in v0.15.0

func (bslhr BlobSetLegalHoldResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobSetLegalHoldResponse) LegalHold added in v0.15.0

func (bslhr BlobSetLegalHoldResponse) LegalHold() string

LegalHold returns the value for header x-ms-legal-hold.

func (BlobSetLegalHoldResponse) RequestID added in v0.15.0

func (bslhr BlobSetLegalHoldResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobSetLegalHoldResponse) Response added in v0.15.0

func (bslhr BlobSetLegalHoldResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobSetLegalHoldResponse) Status added in v0.15.0

func (bslhr BlobSetLegalHoldResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobSetLegalHoldResponse) StatusCode added in v0.15.0

func (bslhr BlobSetLegalHoldResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobSetLegalHoldResponse) Version added in v0.15.0

func (bslhr BlobSetLegalHoldResponse) Version() string

Version returns the value for header x-ms-version.

type BlobSetMetadataResponse

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

BlobSetMetadataResponse ...

func (BlobSetMetadataResponse) ClientRequestID added in v0.10.0

func (bsmr BlobSetMetadataResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobSetMetadataResponse) Date

func (bsmr BlobSetMetadataResponse) Date() time.Time

Date returns the value for header Date.

func (BlobSetMetadataResponse) ETag

func (bsmr BlobSetMetadataResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobSetMetadataResponse) EncryptionKeySha256 added in v0.10.0

func (bsmr BlobSetMetadataResponse) EncryptionKeySha256() string

EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256.

func (BlobSetMetadataResponse) EncryptionScope added in v0.11.0

func (bsmr BlobSetMetadataResponse) EncryptionScope() string

EncryptionScope returns the value for header x-ms-encryption-scope.

func (BlobSetMetadataResponse) ErrorCode

func (bsmr BlobSetMetadataResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobSetMetadataResponse) IsServerEncrypted

func (bsmr BlobSetMetadataResponse) IsServerEncrypted() string

IsServerEncrypted returns the value for header x-ms-request-server-encrypted.

func (BlobSetMetadataResponse) LastModified

func (bsmr BlobSetMetadataResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobSetMetadataResponse) RequestID

func (bsmr BlobSetMetadataResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobSetMetadataResponse) Response

func (bsmr BlobSetMetadataResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobSetMetadataResponse) Status

func (bsmr BlobSetMetadataResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobSetMetadataResponse) StatusCode

func (bsmr BlobSetMetadataResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobSetMetadataResponse) Version

func (bsmr BlobSetMetadataResponse) Version() string

Version returns the value for header x-ms-version.

func (BlobSetMetadataResponse) VersionID added in v0.11.0

func (bsmr BlobSetMetadataResponse) VersionID() string

VersionID returns the value for header x-ms-version-id.

type BlobSetTagsResponse added in v0.11.0

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

BlobSetTagsResponse ...

func (BlobSetTagsResponse) ClientRequestID added in v0.11.0

func (bstr BlobSetTagsResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobSetTagsResponse) Date added in v0.11.0

func (bstr BlobSetTagsResponse) Date() time.Time

Date returns the value for header Date.

func (BlobSetTagsResponse) ErrorCode added in v0.11.0

func (bstr BlobSetTagsResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobSetTagsResponse) RequestID added in v0.11.0

func (bstr BlobSetTagsResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobSetTagsResponse) Response added in v0.11.0

func (bstr BlobSetTagsResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobSetTagsResponse) Status added in v0.11.0

func (bstr BlobSetTagsResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobSetTagsResponse) StatusCode added in v0.11.0

func (bstr BlobSetTagsResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobSetTagsResponse) Version added in v0.11.0

func (bstr BlobSetTagsResponse) Version() string

Version returns the value for header x-ms-version.

type BlobSetTierResponse

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

BlobSetTierResponse ...

func (BlobSetTierResponse) ClientRequestID added in v0.10.0

func (bstr BlobSetTierResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobSetTierResponse) ErrorCode

func (bstr BlobSetTierResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobSetTierResponse) RequestID

func (bstr BlobSetTierResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobSetTierResponse) Response

func (bstr BlobSetTierResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobSetTierResponse) Status

func (bstr BlobSetTierResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobSetTierResponse) StatusCode

func (bstr BlobSetTierResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobSetTierResponse) Version

func (bstr BlobSetTierResponse) Version() string

Version returns the value for header x-ms-version.

type BlobStartCopyFromURLResponse

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

BlobStartCopyFromURLResponse ...

func (BlobStartCopyFromURLResponse) ClientRequestID added in v0.10.0

func (bscfur BlobStartCopyFromURLResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobStartCopyFromURLResponse) CopyID

func (bscfur BlobStartCopyFromURLResponse) CopyID() string

CopyID returns the value for header x-ms-copy-id.

func (BlobStartCopyFromURLResponse) CopyStatus

func (bscfur BlobStartCopyFromURLResponse) CopyStatus() CopyStatusType

CopyStatus returns the value for header x-ms-copy-status.

func (BlobStartCopyFromURLResponse) Date

func (bscfur BlobStartCopyFromURLResponse) Date() time.Time

Date returns the value for header Date.

func (BlobStartCopyFromURLResponse) ETag

func (bscfur BlobStartCopyFromURLResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobStartCopyFromURLResponse) ErrorCode

func (bscfur BlobStartCopyFromURLResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobStartCopyFromURLResponse) LastModified

func (bscfur BlobStartCopyFromURLResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobStartCopyFromURLResponse) RequestID

func (bscfur BlobStartCopyFromURLResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobStartCopyFromURLResponse) Response

func (bscfur BlobStartCopyFromURLResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobStartCopyFromURLResponse) Status

func (bscfur BlobStartCopyFromURLResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobStartCopyFromURLResponse) StatusCode

func (bscfur BlobStartCopyFromURLResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobStartCopyFromURLResponse) Version

func (bscfur BlobStartCopyFromURLResponse) Version() string

Version returns the value for header x-ms-version.

func (BlobStartCopyFromURLResponse) VersionID added in v0.11.0

func (bscfur BlobStartCopyFromURLResponse) VersionID() string

VersionID returns the value for header x-ms-version-id.

type BlobTag added in v0.11.0

type BlobTag struct {
	// XMLName is used for marshalling and is subject to removal in a future release.
	XMLName xml.Name `xml:"Tag"`
	Key     string   `xml:"Key"`
	Value   string   `xml:"Value"`
}

BlobTag ...

type BlobTags added in v0.11.0

type BlobTags struct {

	// XMLName is used for marshalling and is subject to removal in a future release.
	XMLName    xml.Name  `xml:"Tags"`
	BlobTagSet []BlobTag `xml:"TagSet>Tag"`
	// contains filtered or unexported fields
}

BlobTags - Blob tags

func SerializeBlobTags added in v0.11.0

func SerializeBlobTags(blobTagsMap BlobTagsMap) BlobTags

func (BlobTags) ClientRequestID added in v0.11.0

func (bt BlobTags) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobTags) Date added in v0.11.0

func (bt BlobTags) Date() time.Time

Date returns the value for header Date.

func (BlobTags) ErrorCode added in v0.11.0

func (bt BlobTags) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobTags) RequestID added in v0.11.0

func (bt BlobTags) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobTags) Response added in v0.11.0

func (bt BlobTags) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobTags) Status added in v0.11.0

func (bt BlobTags) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobTags) StatusCode added in v0.11.0

func (bt BlobTags) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobTags) Version added in v0.11.0

func (bt BlobTags) Version() string

Version returns the value for header x-ms-version.

type BlobTagsMap added in v0.11.0

type BlobTagsMap map[string]string

type BlobType

type BlobType string

BlobType enumerates the values for blob type.

const (
	// BlobAppendBlob ...
	BlobAppendBlob BlobType = "AppendBlob"
	// BlobBlockBlob ...
	BlobBlockBlob BlobType = "BlockBlob"
	// BlobNone represents an empty BlobType.
	BlobNone BlobType = ""
	// BlobPageBlob ...
	BlobPageBlob BlobType = "PageBlob"
)

func PossibleBlobTypeValues

func PossibleBlobTypeValues() []BlobType

PossibleBlobTypeValues returns an array of possible values for the BlobType const type.

type BlobURL

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

A BlobURL 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.

// From the Azure portal, get your Storage account blob service URL endpoint.
accountName, accountKey := accountInfo()

// Create a ContainerURL object to a container where we'll create a blob and its snapshot.
// Create a BlockBlobURL object to a blob in the container.
u, _ := url.Parse(fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/CopiedBlob.bin", accountName))
credential, err := NewSharedKeyCredential(accountName, accountKey)
if err != nil {
	log.Fatal(err)
}
blobURL := NewBlobURL(*u, NewPipeline(credential, PipelineOptions{}))

ctx := context.Background() // This example uses a never-expiring context

src, _ := url.Parse("https://cdn2.auth0.com/docs/media/addons/azure_blob.svg")
startCopy, err := blobURL.StartCopyFromURL(ctx, *src, nil, ModifiedAccessConditions{}, BlobAccessConditions{}, DefaultAccessTier, nil)
if err != nil {
	log.Fatal(err)
}

copyID := startCopy.CopyID()
copyStatus := startCopy.CopyStatus()
for copyStatus == CopyStatusPending {
	time.Sleep(time.Second * 2)
	getMetadata, err := blobURL.GetProperties(ctx, BlobAccessConditions{}, ClientProvidedKeyOptions{})
	if err != nil {
		log.Fatal(err)
	}
	copyStatus = getMetadata.CopyStatus()
}
fmt.Printf("Copy from %s to %s: ID=%s, Status=%s\n", src.String(), blobURL, copyID, copyStatus)
Output:

func NewBlobURL

func NewBlobURL(url url.URL, p pipeline.Pipeline) BlobURL

NewBlobURL creates a BlobURL object using the specified URL and request policy pipeline.

func (BlobURL) AbortCopyFromURL

func (b BlobURL) AbortCopyFromURL(ctx context.Context, copyID string, ac LeaseAccessConditions) (*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 (BlobURL) AcquireLease

func (b BlobURL) AcquireLease(ctx context.Context, proposedID string, duration int32, ac ModifiedAccessConditions) (*BlobAcquireLeaseResponse, error)

AcquireLease acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 seconds, or infinite (-1). For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob.

func (BlobURL) BreakLease

func (b BlobURL) BreakLease(ctx context.Context, breakPeriodInSeconds int32, ac ModifiedAccessConditions) (*BlobBreakLeaseResponse, error)

BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant to break a fixed-duration lease when it expires or an infinite lease immediately. For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-blob.

func (BlobURL) ChangeLease

func (b BlobURL) ChangeLease(ctx context.Context, leaseID string, proposedID string, ac ModifiedAccessConditions) (*BlobChangeLeaseResponse, error)

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

func (BlobURL) CreateSnapshot

CreateSnapshot creates a read-only snapshot of a blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/snapshot-blob.

func (BlobURL) Delete

Delete marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection. Note 1: that deleting a blob also deletes all its snapshots. Note 2: Snapshot/VersionId are optional parameters which are part of request URL query params.

These parameters can be explicitly set by calling WithSnapshot(snapshot string)/WithVersionID(versionID string)
Therefore it not required to pass these here.

For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-blob.

func (BlobURL) DeleteImmutabilityPolicy added in v0.15.0

func (b BlobURL) DeleteImmutabilityPolicy(ctx context.Context) (*BlobDeleteImmutabilityPolicyResponse, error)

DeleteImmutabilityPolicy deletes a temporary immutability policy with an expiration date. While the immutability policy is active, the blob can be read but not modified or deleted. For more information, see https://docs.microsoft.com/en-us/azure/storage/blobs/immutable-time-based-retention-policy-overview (Feature overview) and https://docs.microsoft.com/en-us/rest/api/storageservices/delete-blob-immutability-policy (REST API reference) A container with object-level immutability enabled is required.

func (BlobURL) Download

func (b BlobURL) Download(ctx context.Context, offset int64, count int64, ac BlobAccessConditions, rangeGetContentMD5 bool, cpk ClientProvidedKeyOptions) (*DownloadResponse, error)

Download reads a range of bytes from a blob. The response also includes the blob's properties and metadata. Passing azblob.CountToEnd (0) for count will download the blob from the offset to the end. Note: Snapshot/VersionId are optional parameters which are part of request URL query params.

These parameters can be explicitly set by calling WithSnapshot(snapshot string)/WithVersionID(versionID string)
Therefore it not required to pass these here.

For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob.

func (BlobURL) GetAccountInfo added in v0.9.0

func (b BlobURL) GetAccountInfo(ctx context.Context) (*BlobGetAccountInfoResponse, error)

func (BlobURL) GetProperties

GetProperties returns the blob's properties. Note: Snapshot/VersionId are optional parameters which are part of request URL query params. These parameters can be explicitly set by calling WithSnapshot(snapshot string)/WithVersionID(versionID string) Therefore it not required to pass these here. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob-properties.

func (BlobURL) GetTags added in v0.11.0

func (b BlobURL) GetTags(ctx context.Context, ifTags *string) (*BlobTags, error)

GetTags operation enables users to get tags on a blob or specific blob version, or snapshot. https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-tags

func (BlobURL) PermanentDelete added in v0.15.0

func (b BlobURL) PermanentDelete(ctx context.Context, deleteOptions DeleteSnapshotsOptionType, ac BlobAccessConditions) (*BlobDeleteResponse, error)

PermanentDelete permanently deletes soft-deleted snapshots & soft-deleted version blobs and is a dangerous operation and SHOULD NOT BE USED. WARNING: This operation should not be used unless you know exactly the implications. We will not provide support for this API. For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-blob.

func (BlobURL) ReleaseLease

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

func (BlobURL) RenewLease

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

func (BlobURL) SetHTTPHeaders

SetHTTPHeaders changes a blob's HTTP headers. For more information, see https://docs.microsoft.com/rest/api/storageservices/set-blob-properties.

func (BlobURL) SetImmutabilityPolicy added in v0.15.0

func (b BlobURL) SetImmutabilityPolicy(ctx context.Context, expiry time.Time, mode BlobImmutabilityPolicyModeType, ifUnmodifiedSince *time.Time) (*BlobSetImmutabilityPolicyResponse, error)

SetImmutabilityPolicy sets a temporary immutability policy with an expiration date. The expiration date must be in the future. While the immutability policy is active, the blob can be read but not modified or deleted. For more information, see https://docs.microsoft.com/en-us/azure/storage/blobs/immutable-time-based-retention-policy-overview (Feature overview) and https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-immutability-policy (REST API reference) A container with object-level immutability enabled is required.

func (BlobURL) SetLegalHold added in v0.15.0

func (b BlobURL) SetLegalHold(ctx context.Context, legalHold bool) (*BlobSetLegalHoldResponse, error)

SetLegalHold enables a temporary immutability policy that can be applied for general data protection purposes. It stores the current blob version in a WORM (Write-Once Read-Many) state. While in effect, the blob can be read but not modified or deleted. For more information, see https://docs.microsoft.com/en-us/azure/storage/blobs/immutable-legal-hold-overview (Feature overview) and https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-legal-hold (REST API reference) A container with object-level immutability enabled is required.

func (BlobURL) SetTags added in v0.11.0

func (b BlobURL) SetTags(ctx context.Context, transactionalContentMD5 []byte, transactionalContentCrc64 []byte, ifTags *string, blobTagsMap BlobTagsMap) (*BlobSetTagsResponse, error)

SetTags operation enables users to set tags on a blob or specific blob version, but not snapshot. Each call to this operation replaces all existing tags attached to the blob. To remove all tags from the blob, call this operation with no tags set. https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-tags

func (BlobURL) SetTier

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. Note: VersionId is an optional parameter which is part of request URL query params. It can be explicitly set by calling WithVersionID(versionID string) function and hence it not required to pass it here. For detailed information about block blob level tiering see https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-storage-tiers.

func (BlobURL) StartCopyFromURL

func (b BlobURL) StartCopyFromURL(ctx context.Context, source url.URL, metadata Metadata, srcac ModifiedAccessConditions, dstac BlobAccessConditions, tier AccessTierType, blobTagsMap BlobTagsMap) (*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 (BlobURL) String

func (b BlobURL) String() string

String returns the URL as a string.

func (BlobURL) ToAppendBlobURL

func (b BlobURL) ToAppendBlobURL() AppendBlobURL

ToAppendBlobURL creates an AppendBlobURL using the source's URL and pipeline.

func (BlobURL) ToBlockBlobURL

func (b BlobURL) ToBlockBlobURL() BlockBlobURL

ToBlockBlobURL creates a BlockBlobURL using the source's URL and pipeline.

func (BlobURL) ToPageBlobURL

func (b BlobURL) ToPageBlobURL() PageBlobURL

ToPageBlobURL creates a PageBlobURL using the source's URL and pipeline.

func (BlobURL) URL

func (b BlobURL) URL() url.URL

URL returns the URL endpoint used by the BlobURL object.

func (BlobURL) Undelete

func (b BlobURL) Undelete(ctx context.Context) (*BlobUndeleteResponse, error)

Undelete restores the contents and metadata of a soft-deleted blob and any associated soft-deleted snapshots. For more information, see https://docs.microsoft.com/rest/api/storageservices/undelete-blob.

func (BlobURL) WithPipeline

func (b BlobURL) WithPipeline(p pipeline.Pipeline) BlobURL

WithPipeline creates a new BlobURL object identical to the source but with the specified request policy pipeline.

func (BlobURL) WithSnapshot

func (b BlobURL) WithSnapshot(snapshot string) BlobURL

WithSnapshot creates a new BlobURL object identical to the source but with the specified snapshot timestamp. Pass "" to remove the snapshot returning a URL to the base blob.

func (BlobURL) WithVersionID added in v0.11.0

func (b BlobURL) WithVersionID(versionID string) BlobURL

WithVersionID creates a new BlobURL object identical to the source but with the specified version id. Pass "" to remove the snapshot returning a URL to the base blob.

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 shows how to break a URL into its parts so you can examine and/or change some of its values and then construct a new URL.

// Let's start with a URL that identifies a snapshot of a blob in a container.
// The URL also contains a Shared Access Signature (SAS):
u, _ := url.Parse("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==")

// You can parse this URL into its constituent parts:
parts := NewBlobURLParts(*u)

// Now, we access the parts (this example prints them).
fmt.Println(parts.Host, parts.ContainerName, parts.BlobName, parts.Snapshot)
sas := parts.SAS
fmt.Println(sas.Version(), sas.Resource(), sas.StartTime(), sas.ExpiryTime(), sas.Permissions(),
	sas.IPRange(), sas.Protocol(), sas.Identifier(), sas.Services(), sas.Signature())

// You can then change some of the fields and construct a new URL:
parts.SAS = SASQueryParameters{}       // Remove the SAS query parameters
parts.Snapshot = ""                    // Remove the snapshot timestamp
parts.ContainerName = "othercontainer" // Change the container name
// In this example, we'll keep the blob name as is.

// Construct a new URL from the parts:
newURL := parts.URL()
fmt.Print(newURL.String())
// NOTE: You can pass the new URL to NewBlockBlobURL (or similar methods) to manipulate the blob.
Output:

func NewBlobURLParts

func NewBlobURLParts(u url.URL) 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() url.URL

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 BlobUndeleteResponse

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

BlobUndeleteResponse ...

func (BlobUndeleteResponse) ClientRequestID added in v0.10.0

func (bur BlobUndeleteResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlobUndeleteResponse) Date

func (bur BlobUndeleteResponse) Date() time.Time

Date returns the value for header Date.

func (BlobUndeleteResponse) ErrorCode

func (bur BlobUndeleteResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlobUndeleteResponse) RequestID

func (bur BlobUndeleteResponse) RequestID() string

RequestID returns the value for header x-ms-request-id.

func (BlobUndeleteResponse) Response

func (bur BlobUndeleteResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlobUndeleteResponse) Status

func (bur BlobUndeleteResponse) Status() string

Status returns the HTTP status message of the response, e.g. "200 OK".

func (BlobUndeleteResponse) StatusCode

func (bur BlobUndeleteResponse) StatusCode() int

StatusCode returns the HTTP status code of the response, e.g. 200.

func (BlobUndeleteResponse) Version

func (bur BlobUndeleteResponse) Version() string

Version returns the value for header x-ms-version.

type Block

type Block struct {
	// Name - The base64 encoded block ID.
	Name string `xml:"Name"`
	// Size - 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 BlockBlobCommitBlockListResponse

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

BlockBlobCommitBlockListResponse ...

func (BlockBlobCommitBlockListResponse) ClientRequestID added in v0.10.0

func (bbcblr BlockBlobCommitBlockListResponse) ClientRequestID() string

ClientRequestID returns the value for header x-ms-client-request-id.

func (BlockBlobCommitBlockListResponse) ContentMD5

func (bbcblr BlockBlobCommitBlockListResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (BlockBlobCommitBlockListResponse) Date

Date returns the value for header Date.

func (BlockBlobCommitBlockListResponse) ETag

func (bbcblr BlockBlobCommitBlockListResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlockBlobCommitBlockListResponse) EncryptionKeySha256 added in v0.10.0

func (bbcblr BlockBlobCommitBlockListResponse) EncryptionKeySha256() string

EncryptionKeySha256 returns the value for header x-ms-encryption-key-sha256.

func (BlockBlobCommitBlockListResponse) EncryptionScope added in v0.11.0

func (bbcblr BlockBlobCommitBlockListResponse) EncryptionScope() string

EncryptionScope returns the value for header x-ms-encryption-scope.

func (BlockBlobCommitBlockListResponse) ErrorCode

func (bbcblr BlockBlobCommitBlockListResponse) ErrorCode() string

ErrorCode returns the value for header x-ms-error-code.

func (BlockBlobCommitBlockListResponse) IsServerEncrypted

func (bbcblr BlockBlobCommitBlockListResponse) IsServerEncrypted() string

IsServerEncrypted returns the value for header x-ms-request-server-encrypted.