Blame vendor/github.com/Azure/azure-storage-blob-go/azblob/zt_doc.go

Packit 63bb0d
// Copyright 2017 Microsoft Corporation. All rights reserved.
Packit 63bb0d
// Use of this source code is governed by an MIT
Packit 63bb0d
// license that can be found in the LICENSE file.
Packit 63bb0d
Packit 63bb0d
/*
Packit 63bb0d
Package azblob allows you to manipulate Azure Storage containers and blobs objects.
Packit 63bb0d
Packit 63bb0d
URL Types
Packit 63bb0d
Packit 63bb0d
The most common types you'll work with are the XxxURL types. The methods of these types make requests
Packit 63bb0d
against the Azure Storage Service.
Packit 63bb0d
Packit 63bb0d
 - ServiceURL's          methods perform operations on a storage account.
Packit 63bb0d
    - ContainerURL's     methods perform operations on an account's container.
Packit 63bb0d
       - BlockBlobURL's  methods perform operations on a container's block blob.
Packit 63bb0d
       - AppendBlobURL's methods perform operations on a container's append blob.
Packit 63bb0d
       - PageBlobURL's   methods perform operations on a container's page blob.
Packit 63bb0d
       - BlobURL's       methods perform operations on a container's blob regardless of the blob's type.
Packit 63bb0d
Packit 63bb0d
Internally, each XxxURL object contains a URL and a request pipeline. The URL indicates the endpoint where each HTTP
Packit 63bb0d
request is sent and the pipeline indicates how the outgoing HTTP request and incoming HTTP response is processed.
Packit 63bb0d
The pipeline specifies things like retry policies, logging, deserialization of HTTP response payloads, and more.
Packit 63bb0d
Packit 63bb0d
Pipelines are threadsafe and may be shared by multiple XxxURL objects. When you create a ServiceURL, you pass
Packit 63bb0d
an initial pipeline. When you call ServiceURL's NewContainerURL method, the new ContainerURL object has its own
Packit 63bb0d
URL but it shares the same pipeline as the parent ServiceURL object.
Packit 63bb0d
Packit 63bb0d
To work with a blob, call one of ContainerURL's 4 NewXxxBlobURL methods depending on how you want to treat the blob.
Packit 63bb0d
To treat the blob as a block blob, append blob, or page blob, call NewBlockBlobURL, NewAppendBlobURL, or NewPageBlobURL
Packit 63bb0d
respectively. These three types are all identical except for the methods they expose; each type exposes the methods
Packit 63bb0d
relevant to the type of blob represented. If you're not sure how you want to treat a blob, you can call NewBlobURL;
Packit 63bb0d
this returns an object whose methods are relevant to any kind of blob. When you call ContainerURL's NewXxxBlobURL,
Packit 63bb0d
the new XxxBlobURL object has its own URL but it shares the same pipeline as the parent ContainerURL object. You
Packit 63bb0d
can easily switch between blob types (method sets) by calling a ToXxxBlobURL method.
Packit 63bb0d
Packit 63bb0d
If you'd like to use a different pipeline with a ServiceURL, ContainerURL, or XxxBlobURL object, then call the XxxURL
Packit 63bb0d
object's WithPipeline method passing in the desired pipeline. The WithPipeline methods create a new XxxURL object
Packit 63bb0d
with the same URL as the original but with the specified pipeline.
Packit 63bb0d
Packit 63bb0d
Note that XxxURL objects use little memory, are goroutine-safe, and many objects share the same pipeline. This means that
Packit 63bb0d
XxxURL objects share a lot of system resources making them very efficient.
Packit 63bb0d
Packit 63bb0d
All of XxxURL's methods that make HTTP requests return rich error handling information so you can discern network failures,
Packit 63bb0d
transient failures, timeout failures, service failures, etc. See the StorageError interface for more information and an
Packit 63bb0d
example of how to do deal with errors.
Packit 63bb0d
Packit 63bb0d
URL and Shared Access Signature Manipulation
Packit 63bb0d
Packit 63bb0d
The library includes a BlobURLParts type for deconstructing and reconstructing URLs. And you can use the following types
Packit 63bb0d
for generating and parsing Shared Access Signature (SAS)
Packit 63bb0d
 - Use the AccountSASSignatureValues type to create a SAS for a storage account.
Packit 63bb0d
 - Use the BlobSASSignatureValues type to create a SAS for a container or blob.
Packit 63bb0d
 - Use the SASQueryParameters type to turn signature values in to query parameres or to parse query parameters.
Packit 63bb0d
Packit 63bb0d
To generate a SAS, you must use the SharedKeyCredential type.
Packit 63bb0d
Packit 63bb0d
Credentials
Packit 63bb0d
Packit 63bb0d
When creating a request pipeline, you must specify one of this package's credential types.
Packit 63bb0d
 - Call the NewAnonymousCredential function for requests that contain a Shared Access Signature (SAS).
Packit 63bb0d
 - Call the NewSharedKeyCredential function (with an account name & key) to access any account resources. You must also use this
Packit 63bb0d
   to generate Shared Access Signatures.
Packit 63bb0d
Packit 63bb0d
HTTP Request Policy Factories
Packit 63bb0d
Packit 63bb0d
This package defines several request policy factories for use with the pipeline package.
Packit 63bb0d
Most applications will not use these factories directly; instead, the NewPipeline
Packit 63bb0d
function creates these factories, initializes them (via the PipelineOptions type)
Packit 63bb0d
and returns a pipeline object for use by the XxxURL objects.
Packit 63bb0d
Packit 63bb0d
However, for advanced scenarios, developers can access these policy factories directly
Packit 63bb0d
and even create their own and then construct their own pipeline in order to affect HTTP
Packit 63bb0d
requests and responses performed by the XxxURL objects. For example, developers can
Packit 63bb0d
introduce their own logging, random failures, request recording & playback for fast
Packit 63bb0d
testing, HTTP request pacing, alternate retry mechanisms, metering, metrics, etc. The
Packit 63bb0d
possibilities are endless!
Packit 63bb0d
Packit 63bb0d
Below are the request pipeline policy factory functions that are provided with this
Packit 63bb0d
package:
Packit 63bb0d
 - NewRetryPolicyFactory           Enables rich retry semantics for failed HTTP requests.
Packit 63bb0d
 - NewRequestLogPolicyFactory      Enables rich logging support for HTTP requests/responses & failures.
Packit 63bb0d
 - NewTelemetryPolicyFactory       Enables simple modification of the HTTP request's User-Agent header so each request reports the SDK version & language/runtime making the requests.
Packit 63bb0d
 - NewUniqueRequestIDPolicyFactory Adds a x-ms-client-request-id header with a unique UUID value to an HTTP request to help with diagnosing failures.
Packit 63bb0d
Packit 63bb0d
Also, note that all the NewXxxCredential functions return request policy factory objects which get injected into the pipeline.
Packit 63bb0d
*/
Packit 63bb0d
package azblob
Packit 63bb0d
Packit 63bb0d
// 	TokenCredential     Use this to access resources using Role-Based Access Control (RBAC).