azure-storage-blob-go: github.com/Azure/azure-storage-blob-go/azblob Index | Examples | Files

package azblob

import "github.com/Azure/azure-storage-blob-go/azblob"

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.

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

Code:

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

// Use your Storage account's name and key to create a credential object; this is used to access your account.
credential, err := azblob.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 := azblob.NewPipeline(credential, azblob.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 := azblob.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, azblob.Metadata{}, azblob.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), azblob.BlobHTTPHeaders{ContentType: "text/plain"}, azblob.Metadata{}, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}

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

downloadedData := &bytes.Buffer{}
reader := get.Body(azblob.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 := (azblob.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, azblob.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, azblob.DeleteSnapshotsOptionNone, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}

// Delete the container we created earlier.
_, err = containerURL.Delete(ctx, azblob.ContainerAccessConditions{})
if err != nil {
    log.Fatal(err)
}

This example show how to create a blob, take a snapshot of it, update the base blob, read from the blob snapshot, list blobs with their snapshots, and hot to delete blob snapshots.

Code:

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

// Create a 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 := azblob.NewSharedKeyCredential(accountName, accountKey)
if err != nil {
    log.Fatal(err)
}
containerURL := azblob.NewContainerURL(*u, azblob.NewPipeline(credential, azblob.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"), azblob.BlobHTTPHeaders{}, azblob.Metadata{}, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}

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

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

get, err := baseBlobURL.Download(ctx, 0, 0, azblob.BlobAccessConditions{}, false)
b := bytes.Buffer{}
reader := get.Body(azblob.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, azblob.BlobAccessConditions{}, false)
b.Reset()
reader = get.Body(azblob.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 := (azblob.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, azblob.ListBlobsSegmentOptions{
        Details: azblob.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(), azblob.Metadata{}, azblob.ModifiedAccessConditions{}, azblob.BlobAccessConditions{})
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, azblob.DeleteSnapshotsOptionInclude, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}

Code:

// Create a request pipeline using your Storage account's name and account key.
accountName, accountKey := accountInfo()
credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
if err != nil {
    log.Fatal(err)
}
p := azblob.NewPipeline(credential, azblob.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 := azblob.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())
    }),
    azblob.BlobHTTPHeaders{
        ContentType:        "text/html; charset=utf-8",
        ContentDisposition: "attachment",
    }, azblob.Metadata{}, azblob.BlobAccessConditions{})
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, azblob.BlobAccessConditions{}, false)
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(azblob.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

Index

Examples

Package Files

access_conditions.go atomicmorph.go highlevel.go parsing_urls.go sas_service.go service_codes_blob.go storage_account_credential.go url_append_blob.go url_blob.go url_block_blob.go url_container.go url_page_blob.go url_service.go user_delegation_credential.go version.go zc_credential_anonymous.go zc_credential_shared_key.go zc_credential_token.go zc_mmf_unix.go zc_pipeline.go zc_policy_request_log.go zc_policy_retry.go zc_policy_telemetry.go zc_policy_unique_request_id.go zc_retry_reader.go zc_sas_account.go zc_sas_query_params.go zc_service_codes_common.go zc_storage_error.go zc_util_validate.go zc_uuid.go zt_doc.go zz_generated_append_blob.go zz_generated_blob.go zz_generated_block_blob.go zz_generated_client.go zz_generated_container.go zz_generated_models.go zz_generated_page_blob.go zz_generated_responder_policy.go zz_generated_response_error.go zz_generated_service.go zz_generated_validation.go zz_generated_version.go zz_response_helpers.go

Constants

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
)
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 = 100 * 1024 * 1024 // 100MB

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

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

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

const ReadOnClosedBodyMessage = "read on closed response body"
const SASTimeFormat = "2006-01-02T15:04:05Z" //"2017-07-27T00:00:00Z" // ISO 8601

SASTimeFormat represents the format of a SAS start or expiry time. Use it when formatting/parsing a time.Time.

const SASVersion = ServiceVersion

SASVersion indicates the SAS version.

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

func DownloadBlobToBuffer Uses

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 Uses

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 Uses

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 Uses

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

NewPipeline creates a Pipeline using the specified credentials and options.

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

Code:

// 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 := azblob.PipelineOptions{
    // Set RetryOptions to control how HTTP request are retried when retryable failures occur
    Retry: azblob.RetryOptions{
        Policy:        azblob.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: azblob.RequestLogOptions{
        LogWarningIfTryOverThreshold: time.Millisecond * 200, // A successful response taking more than this time to arrive is logged as a warning
    },

    // 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 &httpResponse{response: 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 := azblob.NewPipeline(azblob.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 := azblob.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 = azblob.RetryOptions{
    Policy:        azblob.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(azblob.NewPipeline(azblob.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

func NewRequestLogPolicyFactory Uses

func NewRequestLogPolicyFactory(o RequestLogOptions) pipeline.Factory

NewRequestLogPolicyFactory creates a RequestLogPolicyFactory object configured using the specified options.

func NewResponseError Uses

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

NewResponseError creates an error object that implements the error interface.

func NewRetryPolicyFactory Uses

func NewRetryPolicyFactory(o RetryOptions) pipeline.Factory

NewRetryPolicyFactory creates a RetryPolicyFactory object configured using the specified options.

func NewRetryReader Uses

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

NewRetryReader creates a retry reader.

func NewTelemetryPolicyFactory Uses

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 Uses

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 Uses

func RedactSigQueryParam(rawQuery string) (bool, string)

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

func UserAgent Uses

func UserAgent() string

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

func Version Uses

func Version() string

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

type AccessPolicy Uses

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 Uses

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

MarshalXML implements the xml.Marshaler interface for AccessPolicy.

func (*AccessPolicy) UnmarshalXML Uses

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

UnmarshalXML implements the xml.Unmarshaler interface for AccessPolicy.

type AccessPolicyPermission Uses

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 Uses

func (p *AccessPolicyPermission) Parse(s string) error

Parse initializes the AccessPolicyPermission's fields from a string.

func (AccessPolicyPermission) String Uses

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 Uses

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"
    // AccessTierP20 ...
    AccessTierP20 AccessTierType = "P20"
    // AccessTierP30 ...
    AccessTierP30 AccessTierType = "P30"
    // AccessTierP4 ...
    AccessTierP4 AccessTierType = "P4"
    // AccessTierP40 ...
    AccessTierP40 AccessTierType = "P40"
    // AccessTierP50 ...
    AccessTierP50 AccessTierType = "P50"
    // AccessTierP6 ...
    AccessTierP6 AccessTierType = "P6"
)

func PossibleAccessTierTypeValues Uses

func PossibleAccessTierTypeValues() []AccessTierType

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

type AccountKindType Uses

type AccountKindType string

AccountKindType enumerates the values for account kind type.

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

func PossibleAccountKindTypeValues Uses

func PossibleAccountKindTypeValues() []AccountKindType

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

type AccountSASPermissions Uses

type AccountSASPermissions struct {
    Read, Write, Delete, List, Add, Create, Update, Process bool
}

The AccountSASPermissions type simplifies creating the permissions string for an Azure Storage Account SAS. Initialize an instance of this type and then call its String method to set AccountSASSignatureValues's Permissions field.

func (*AccountSASPermissions) Parse Uses

func (p *AccountSASPermissions) Parse(s string) error

Parse initializes the AccountSASPermissions's fields from a string.

func (AccountSASPermissions) String Uses

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 Uses

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 Uses

func (rt *AccountSASResourceTypes) Parse(s string) error

Parse initializes the AccountSASResourceType's fields from a string.

func (AccountSASResourceTypes) String Uses

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 Uses

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 Uses

func (a *AccountSASServices) Parse(s string) error

Parse initializes the AccountSASServices' fields from a string.

func (AccountSASServices) String Uses

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 Uses

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

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

Code:

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

// Use your Storage account's name and key to create a credential object; this is required to sign a SAS.
credential, err := azblob.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 := azblob.AccountSASSignatureValues{
    Protocol:      azblob.SASProtocolHTTPS,              // Users MUST use HTTPS (not HTTP)
    ExpiryTime:    time.Now().UTC().Add(48 * time.Hour), // 48-hours before expiration
    Permissions:   azblob.AccountSASPermissions{Read: true, List: true}.String(),
    Services:      azblob.AccountSASServices{Blob: true}.String(),
    ResourceTypes: azblob.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 := azblob.NewServiceURL(*u, azblob.NewPipeline(azblob.NewAnonymousCredential(), azblob.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 := azblob.NewBlobURLParts(serviceURL.URL())
fmt.Printf("SAS expiry time=%v", blobURLParts.SAS.ExpiryTime())

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

func (AccountSASSignatureValues) NewSASQueryParameters Uses

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 AppendBlobAccessConditions Uses

type AppendBlobAccessConditions struct {
    ModifiedAccessConditions
    LeaseAccessConditions
    AppendPositionAccessConditions
}

type AppendBlobAppendBlockFromURLResponse Uses

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

AppendBlobAppendBlockFromURLResponse ...

func (AppendBlobAppendBlockFromURLResponse) BlobAppendOffset Uses

func (ababfur AppendBlobAppendBlockFromURLResponse) BlobAppendOffset() string

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

func (AppendBlobAppendBlockFromURLResponse) BlobCommittedBlockCount Uses

func (ababfur AppendBlobAppendBlockFromURLResponse) BlobCommittedBlockCount() int32

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

func (AppendBlobAppendBlockFromURLResponse) ContentMD5 Uses

func (ababfur AppendBlobAppendBlockFromURLResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (AppendBlobAppendBlockFromURLResponse) Date Uses

func (ababfur AppendBlobAppendBlockFromURLResponse) Date() time.Time

Date returns the value for header Date.

func (AppendBlobAppendBlockFromURLResponse) ETag Uses

func (ababfur AppendBlobAppendBlockFromURLResponse) ETag() ETag

ETag returns the value for header ETag.

func (AppendBlobAppendBlockFromURLResponse) ErrorCode Uses

func (ababfur AppendBlobAppendBlockFromURLResponse) ErrorCode() string

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

func (AppendBlobAppendBlockFromURLResponse) LastModified Uses

func (ababfur AppendBlobAppendBlockFromURLResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (AppendBlobAppendBlockFromURLResponse) RequestID Uses

func (ababfur AppendBlobAppendBlockFromURLResponse) RequestID() string

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

func (AppendBlobAppendBlockFromURLResponse) Response Uses

func (ababfur AppendBlobAppendBlockFromURLResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (AppendBlobAppendBlockFromURLResponse) Status Uses

func (ababfur AppendBlobAppendBlockFromURLResponse) Status() string

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

func (AppendBlobAppendBlockFromURLResponse) StatusCode Uses

func (ababfur AppendBlobAppendBlockFromURLResponse) StatusCode() int

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

func (AppendBlobAppendBlockFromURLResponse) Version Uses

func (ababfur AppendBlobAppendBlockFromURLResponse) Version() string

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

type AppendBlobAppendBlockResponse Uses

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

AppendBlobAppendBlockResponse ...

func (AppendBlobAppendBlockResponse) BlobAppendOffset Uses

func (ababr AppendBlobAppendBlockResponse) BlobAppendOffset() string

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

func (AppendBlobAppendBlockResponse) BlobCommittedBlockCount Uses

func (ababr AppendBlobAppendBlockResponse) BlobCommittedBlockCount() int32

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

func (AppendBlobAppendBlockResponse) ContentMD5 Uses

func (ababr AppendBlobAppendBlockResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (AppendBlobAppendBlockResponse) Date Uses

func (ababr AppendBlobAppendBlockResponse) Date() time.Time

Date returns the value for header Date.

func (AppendBlobAppendBlockResponse) ETag Uses

func (ababr AppendBlobAppendBlockResponse) ETag() ETag

ETag returns the value for header ETag.

func (AppendBlobAppendBlockResponse) ErrorCode Uses

func (ababr AppendBlobAppendBlockResponse) ErrorCode() string

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

func (AppendBlobAppendBlockResponse) IsServerEncrypted Uses

func (ababr AppendBlobAppendBlockResponse) IsServerEncrypted() string

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

func (AppendBlobAppendBlockResponse) LastModified Uses

func (ababr AppendBlobAppendBlockResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (AppendBlobAppendBlockResponse) RequestID Uses

func (ababr AppendBlobAppendBlockResponse) RequestID() string

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

func (AppendBlobAppendBlockResponse) Response Uses

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

Response returns the raw HTTP response object.

func (AppendBlobAppendBlockResponse) Status Uses

func (ababr AppendBlobAppendBlockResponse) Status() string

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

func (AppendBlobAppendBlockResponse) StatusCode Uses

func (ababr AppendBlobAppendBlockResponse) StatusCode() int

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

func (AppendBlobAppendBlockResponse) Version Uses

func (ababr AppendBlobAppendBlockResponse) Version() string

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

type AppendBlobCreateResponse Uses

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

AppendBlobCreateResponse ...

func (AppendBlobCreateResponse) ContentMD5 Uses

func (abcr AppendBlobCreateResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (AppendBlobCreateResponse) Date Uses

func (abcr AppendBlobCreateResponse) Date() time.Time

Date returns the value for header Date.

func (AppendBlobCreateResponse) ETag Uses

func (abcr AppendBlobCreateResponse) ETag() ETag

ETag returns the value for header ETag.

func (AppendBlobCreateResponse) ErrorCode Uses

func (abcr AppendBlobCreateResponse) ErrorCode() string

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

func (AppendBlobCreateResponse) IsServerEncrypted Uses

func (abcr AppendBlobCreateResponse) IsServerEncrypted() string

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

func (AppendBlobCreateResponse) LastModified Uses

func (abcr AppendBlobCreateResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (AppendBlobCreateResponse) RequestID Uses

func (abcr AppendBlobCreateResponse) RequestID() string

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

func (AppendBlobCreateResponse) Response Uses

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

Response returns the raw HTTP response object.

func (AppendBlobCreateResponse) Status Uses

func (abcr AppendBlobCreateResponse) Status() string

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

func (AppendBlobCreateResponse) StatusCode Uses

func (abcr AppendBlobCreateResponse) StatusCode() int

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

func (AppendBlobCreateResponse) Version Uses

func (abcr AppendBlobCreateResponse) Version() string

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

type AppendBlobURL Uses

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

AppendBlobURL defines a set of operations applicable to append blobs.

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

Code:

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

ctx := context.Background() // This example uses a never-expiring context
_, err = appendBlobURL.Create(ctx, azblob.BlobHTTPHeaders{}, azblob.Metadata{}, azblob.BlobAccessConditions{})
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)), azblob.AppendBlobAccessConditions{}, nil)
    if err != nil {
        log.Fatal(err)
    }
}

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

func NewAppendBlobURL Uses

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 Uses

func (ab AppendBlobURL) AppendBlock(ctx context.Context, body io.ReadSeeker, ac AppendBlobAccessConditions, transactionalMD5 []byte) (*AppendBlobAppendBlockResponse, error)

AppendBlock writes a stream to a new block of data to the end of the existing append blob. This method panics if the stream is not at position 0. Note that the http client closes the body stream after the request is sent to the service. For more information, see https://docs.microsoft.com/rest/api/storageservices/append-block.

func (AppendBlobURL) AppendBlockFromURL Uses

func (ab AppendBlobURL) AppendBlockFromURL(ctx context.Context, sourceURL url.URL, offset int64, count int64, destinationAccessConditions AppendBlobAccessConditions, sourceAccessConditions ModifiedAccessConditions, transactionalMD5 []byte) (*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 Uses

func (ab AppendBlobURL) Create(ctx context.Context, h BlobHTTPHeaders, metadata Metadata, ac BlobAccessConditions) (*AppendBlobCreateResponse, error)

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) WithPipeline Uses

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 Uses

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.

type AppendPositionAccessConditions Uses

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 Uses

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 Uses

func PossibleArchiveStatusTypeValues() []ArchiveStatusType

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

type BlobAbortCopyFromURLResponse Uses

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

BlobAbortCopyFromURLResponse ...

func (BlobAbortCopyFromURLResponse) Date Uses

func (bacfur BlobAbortCopyFromURLResponse) Date() time.Time

Date returns the value for header Date.

func (BlobAbortCopyFromURLResponse) ErrorCode Uses

func (bacfur BlobAbortCopyFromURLResponse) ErrorCode() string

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

func (BlobAbortCopyFromURLResponse) RequestID Uses

func (bacfur BlobAbortCopyFromURLResponse) RequestID() string

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

func (BlobAbortCopyFromURLResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobAbortCopyFromURLResponse) Status Uses

func (bacfur BlobAbortCopyFromURLResponse) Status() string

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

func (BlobAbortCopyFromURLResponse) StatusCode Uses

func (bacfur BlobAbortCopyFromURLResponse) StatusCode() int

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

func (BlobAbortCopyFromURLResponse) Version Uses

func (bacfur BlobAbortCopyFromURLResponse) Version() string

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

type BlobAccessConditions Uses

type BlobAccessConditions struct {
    ModifiedAccessConditions
    LeaseAccessConditions
}

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

This example shows how to perform operations on blob conditionally.

Code:

// 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 := azblob.NewSharedKeyCredential(accountName, accountKey)
if err != nil {
    log.Fatal(err)
}
blobURL := azblob.NewBlockBlobURL(*u, azblob.NewPipeline(credential, azblob.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.(azblob.StorageError); !ok {
            log.Fatal(err) // Network failure
        } else {
            fmt.Print("Failure: " + stgErr.Response().Status + "\n")
        }
    } else {
        if get, ok := response.(*azblob.DownloadResponse); ok {
            get.Body(azblob.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"), azblob.BlobHTTPHeaders{}, azblob.Metadata{}, azblob.BlobAccessConditions{})
showResult(upload, err)

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

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

// 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"), azblob.BlobHTTPHeaders{}, azblob.Metadata{},
    azblob.BlobAccessConditions{ModifiedAccessConditions: azblob.ModifiedAccessConditions{IfMatch: upload.ETag()}})
showResult(upload, err)

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

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

type BlobAcquireLeaseResponse Uses

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

BlobAcquireLeaseResponse ...

func (BlobAcquireLeaseResponse) Date Uses

func (balr BlobAcquireLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (BlobAcquireLeaseResponse) ETag Uses

func (balr BlobAcquireLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobAcquireLeaseResponse) ErrorCode Uses

func (balr BlobAcquireLeaseResponse) ErrorCode() string

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

func (BlobAcquireLeaseResponse) LastModified Uses

func (balr BlobAcquireLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobAcquireLeaseResponse) LeaseID Uses

func (balr BlobAcquireLeaseResponse) LeaseID() string

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

func (BlobAcquireLeaseResponse) RequestID Uses

func (balr BlobAcquireLeaseResponse) RequestID() string

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

func (BlobAcquireLeaseResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobAcquireLeaseResponse) Status Uses

func (balr BlobAcquireLeaseResponse) Status() string

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

func (BlobAcquireLeaseResponse) StatusCode Uses

func (balr BlobAcquireLeaseResponse) StatusCode() int

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

func (BlobAcquireLeaseResponse) Version Uses

func (balr BlobAcquireLeaseResponse) Version() string

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

type BlobBreakLeaseResponse Uses

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

BlobBreakLeaseResponse ...

func (BlobBreakLeaseResponse) Date Uses

func (bblr BlobBreakLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (BlobBreakLeaseResponse) ETag Uses

func (bblr BlobBreakLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobBreakLeaseResponse) ErrorCode Uses

func (bblr BlobBreakLeaseResponse) ErrorCode() string

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

func (BlobBreakLeaseResponse) LastModified Uses

func (bblr BlobBreakLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobBreakLeaseResponse) LeaseTime Uses

func (bblr BlobBreakLeaseResponse) LeaseTime() int32

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

func (BlobBreakLeaseResponse) RequestID Uses

func (bblr BlobBreakLeaseResponse) RequestID() string

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

func (BlobBreakLeaseResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobBreakLeaseResponse) Status Uses

func (bblr BlobBreakLeaseResponse) Status() string

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

func (BlobBreakLeaseResponse) StatusCode Uses

func (bblr BlobBreakLeaseResponse) StatusCode() int

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

func (BlobBreakLeaseResponse) Version Uses

func (bblr BlobBreakLeaseResponse) Version() string

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

type BlobChangeLeaseResponse Uses

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

BlobChangeLeaseResponse ...

func (BlobChangeLeaseResponse) Date Uses

func (bclr BlobChangeLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (BlobChangeLeaseResponse) ETag Uses

func (bclr BlobChangeLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobChangeLeaseResponse) ErrorCode Uses

func (bclr BlobChangeLeaseResponse) ErrorCode() string

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

func (BlobChangeLeaseResponse) LastModified Uses

func (bclr BlobChangeLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobChangeLeaseResponse) LeaseID Uses

func (bclr BlobChangeLeaseResponse) LeaseID() string

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

func (BlobChangeLeaseResponse) RequestID Uses

func (bclr BlobChangeLeaseResponse) RequestID() string

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

func (BlobChangeLeaseResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobChangeLeaseResponse) Status Uses

func (bclr BlobChangeLeaseResponse) Status() string

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

func (BlobChangeLeaseResponse) StatusCode Uses

func (bclr BlobChangeLeaseResponse) StatusCode() int

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

func (BlobChangeLeaseResponse) Version Uses

func (bclr BlobChangeLeaseResponse) Version() string

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

type BlobCopyFromURLResponse Uses

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

BlobCopyFromURLResponse ...

func (BlobCopyFromURLResponse) CopyID Uses

func (bcfur BlobCopyFromURLResponse) CopyID() string

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

func (BlobCopyFromURLResponse) CopyStatus Uses

func (bcfur BlobCopyFromURLResponse) CopyStatus() SyncCopyStatusType

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

func (BlobCopyFromURLResponse) Date Uses

func (bcfur BlobCopyFromURLResponse) Date() time.Time

Date returns the value for header Date.

func (BlobCopyFromURLResponse) ETag Uses

func (bcfur BlobCopyFromURLResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobCopyFromURLResponse) ErrorCode Uses

func (bcfur BlobCopyFromURLResponse) ErrorCode() string

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

func (BlobCopyFromURLResponse) LastModified Uses

func (bcfur BlobCopyFromURLResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobCopyFromURLResponse) RequestID Uses

func (bcfur BlobCopyFromURLResponse) RequestID() string

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

func (BlobCopyFromURLResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobCopyFromURLResponse) Status Uses

func (bcfur BlobCopyFromURLResponse) Status() string

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

func (BlobCopyFromURLResponse) StatusCode Uses

func (bcfur BlobCopyFromURLResponse) StatusCode() int

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

func (BlobCopyFromURLResponse) Version Uses

func (bcfur BlobCopyFromURLResponse) Version() string

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

type BlobCreateSnapshotResponse Uses

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

BlobCreateSnapshotResponse ...

func (BlobCreateSnapshotResponse) Date Uses

func (bcsr BlobCreateSnapshotResponse) Date() time.Time

Date returns the value for header Date.

func (BlobCreateSnapshotResponse) ETag Uses

func (bcsr BlobCreateSnapshotResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobCreateSnapshotResponse) ErrorCode Uses

func (bcsr BlobCreateSnapshotResponse) ErrorCode() string

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

func (BlobCreateSnapshotResponse) LastModified Uses

func (bcsr BlobCreateSnapshotResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobCreateSnapshotResponse) RequestID Uses

func (bcsr BlobCreateSnapshotResponse) RequestID() string

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

func (BlobCreateSnapshotResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobCreateSnapshotResponse) Snapshot Uses

func (bcsr BlobCreateSnapshotResponse) Snapshot() string

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

func (BlobCreateSnapshotResponse) Status Uses

func (bcsr BlobCreateSnapshotResponse) Status() string

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

func (BlobCreateSnapshotResponse) StatusCode Uses

func (bcsr BlobCreateSnapshotResponse) StatusCode() int

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

func (BlobCreateSnapshotResponse) Version Uses

func (bcsr BlobCreateSnapshotResponse) Version() string

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

type BlobDeleteResponse Uses

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

BlobDeleteResponse ...

func (BlobDeleteResponse) Date Uses

func (bdr BlobDeleteResponse) Date() time.Time

Date returns the value for header Date.

func (BlobDeleteResponse) ErrorCode Uses

func (bdr BlobDeleteResponse) ErrorCode() string

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

func (BlobDeleteResponse) RequestID Uses

func (bdr BlobDeleteResponse) RequestID() string

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

func (BlobDeleteResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobDeleteResponse) Status Uses

func (bdr BlobDeleteResponse) Status() string

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

func (BlobDeleteResponse) StatusCode Uses

func (bdr BlobDeleteResponse) StatusCode() int

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

func (BlobDeleteResponse) Version Uses

func (bdr BlobDeleteResponse) Version() string

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

type BlobFlatListSegment Uses

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

BlobFlatListSegment ...

type BlobGetAccountInfoResponse Uses

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

BlobGetAccountInfoResponse ...

func (BlobGetAccountInfoResponse) AccountKind Uses

func (bgair BlobGetAccountInfoResponse) AccountKind() AccountKindType

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

func (BlobGetAccountInfoResponse) Date Uses

func (bgair BlobGetAccountInfoResponse) Date() time.Time

Date returns the value for header Date.

func (BlobGetAccountInfoResponse) ErrorCode Uses

func (bgair BlobGetAccountInfoResponse) ErrorCode() string

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

func (BlobGetAccountInfoResponse) RequestID Uses

func (bgair BlobGetAccountInfoResponse) RequestID() string

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

func (BlobGetAccountInfoResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobGetAccountInfoResponse) SkuName Uses

func (bgair BlobGetAccountInfoResponse) SkuName() SkuNameType

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

func (BlobGetAccountInfoResponse) Status Uses

func (bgair BlobGetAccountInfoResponse) Status() string

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

func (BlobGetAccountInfoResponse) StatusCode Uses

func (bgair BlobGetAccountInfoResponse) StatusCode() int

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

func (BlobGetAccountInfoResponse) Version Uses

func (bgair BlobGetAccountInfoResponse) Version() string

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

type BlobGetPropertiesResponse Uses

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

BlobGetPropertiesResponse ...

func (BlobGetPropertiesResponse) AcceptRanges Uses

func (bgpr BlobGetPropertiesResponse) AcceptRanges() string

AcceptRanges returns the value for header Accept-Ranges.

func (BlobGetPropertiesResponse) AccessTier Uses

func (bgpr BlobGetPropertiesResponse) AccessTier() string

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

func (BlobGetPropertiesResponse) AccessTierChangeTime Uses

func (bgpr BlobGetPropertiesResponse) AccessTierChangeTime() time.Time

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

func (BlobGetPropertiesResponse) AccessTierInferred Uses

func (bgpr BlobGetPropertiesResponse) AccessTierInferred() string

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

func (BlobGetPropertiesResponse) ArchiveStatus Uses

func (bgpr BlobGetPropertiesResponse) ArchiveStatus() string

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

func (BlobGetPropertiesResponse) BlobCommittedBlockCount Uses

func (bgpr BlobGetPropertiesResponse) BlobCommittedBlockCount() int32

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

func (BlobGetPropertiesResponse) BlobSequenceNumber Uses

func (bgpr BlobGetPropertiesResponse) BlobSequenceNumber() int64

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

func (BlobGetPropertiesResponse) BlobType Uses

func (bgpr BlobGetPropertiesResponse) BlobType() BlobType

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

func (BlobGetPropertiesResponse) CacheControl Uses

func (bgpr BlobGetPropertiesResponse) CacheControl() string

CacheControl returns the value for header Cache-Control.

func (BlobGetPropertiesResponse) ContentDisposition Uses

func (bgpr BlobGetPropertiesResponse) ContentDisposition() string

ContentDisposition returns the value for header Content-Disposition.

func (BlobGetPropertiesResponse) ContentEncoding Uses

func (bgpr BlobGetPropertiesResponse) ContentEncoding() string

ContentEncoding returns the value for header Content-Encoding.

func (BlobGetPropertiesResponse) ContentLanguage Uses

func (bgpr BlobGetPropertiesResponse) ContentLanguage() string

ContentLanguage returns the value for header Content-Language.

func (BlobGetPropertiesResponse) ContentLength Uses

func (bgpr BlobGetPropertiesResponse) ContentLength() int64

ContentLength returns the value for header Content-Length.

func (BlobGetPropertiesResponse) ContentMD5 Uses

func (bgpr BlobGetPropertiesResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (BlobGetPropertiesResponse) ContentType Uses

func (bgpr BlobGetPropertiesResponse) ContentType() string

ContentType returns the value for header Content-Type.

func (BlobGetPropertiesResponse) CopyCompletionTime Uses

func (bgpr BlobGetPropertiesResponse) CopyCompletionTime() time.Time

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

func (BlobGetPropertiesResponse) CopyID Uses

func (bgpr BlobGetPropertiesResponse) CopyID() string

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

func (BlobGetPropertiesResponse) CopyProgress Uses

func (bgpr BlobGetPropertiesResponse) CopyProgress() string

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

func (BlobGetPropertiesResponse) CopySource Uses

func (bgpr BlobGetPropertiesResponse) CopySource() string

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

func (BlobGetPropertiesResponse) CopyStatus Uses

func (bgpr BlobGetPropertiesResponse) CopyStatus() CopyStatusType

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

func (BlobGetPropertiesResponse) CopyStatusDescription Uses

func (bgpr BlobGetPropertiesResponse) CopyStatusDescription() string

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

func (BlobGetPropertiesResponse) CreationTime Uses

func (bgpr BlobGetPropertiesResponse) CreationTime() time.Time

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

func (BlobGetPropertiesResponse) Date Uses

func (bgpr BlobGetPropertiesResponse) Date() time.Time

Date returns the value for header Date.

func (BlobGetPropertiesResponse) DestinationSnapshot Uses

func (bgpr BlobGetPropertiesResponse) DestinationSnapshot() string

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

func (BlobGetPropertiesResponse) ETag Uses

func (bgpr BlobGetPropertiesResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobGetPropertiesResponse) ErrorCode Uses

func (bgpr BlobGetPropertiesResponse) ErrorCode() string

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

func (BlobGetPropertiesResponse) IsIncrementalCopy Uses

func (bgpr BlobGetPropertiesResponse) IsIncrementalCopy() string

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

func (BlobGetPropertiesResponse) IsServerEncrypted Uses

func (bgpr BlobGetPropertiesResponse) IsServerEncrypted() string

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

func (BlobGetPropertiesResponse) LastModified Uses

func (bgpr BlobGetPropertiesResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobGetPropertiesResponse) LeaseDuration Uses

func (bgpr BlobGetPropertiesResponse) LeaseDuration() LeaseDurationType

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

func (BlobGetPropertiesResponse) LeaseState Uses

func (bgpr BlobGetPropertiesResponse) LeaseState() LeaseStateType

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

func (BlobGetPropertiesResponse) LeaseStatus Uses

func (bgpr BlobGetPropertiesResponse) LeaseStatus() LeaseStatusType

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

func (BlobGetPropertiesResponse) NewHTTPHeaders Uses

func (bgpr BlobGetPropertiesResponse) NewHTTPHeaders() BlobHTTPHeaders

NewHTTPHeaders returns the user-modifiable properties for this blob.

func (BlobGetPropertiesResponse) NewMetadata Uses

func (bgpr BlobGetPropertiesResponse) NewMetadata() Metadata

NewMetadata returns user-defined key/value pairs.

func (BlobGetPropertiesResponse) RequestID Uses

func (bgpr BlobGetPropertiesResponse) RequestID() string

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

func (BlobGetPropertiesResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobGetPropertiesResponse) Status Uses

func (bgpr BlobGetPropertiesResponse) Status() string

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

func (BlobGetPropertiesResponse) StatusCode Uses

func (bgpr BlobGetPropertiesResponse) StatusCode() int

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

func (BlobGetPropertiesResponse) Version Uses

func (bgpr BlobGetPropertiesResponse) Version() string

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

type BlobHTTPHeaders Uses

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

BlobHTTPHeaders contains read/writeable blob properties.

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

Code:

// 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 := azblob.NewSharedKeyCredential(accountName, accountKey)
if err != nil {
    log.Fatal(err)
}
blobURL := azblob.NewBlockBlobURL(*u, azblob.NewPipeline(credential, azblob.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"),
    azblob.BlobHTTPHeaders{
        ContentType:        "text/html; charset=utf-8",
        ContentDisposition: "attachment",
    }, azblob.Metadata{}, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}

// GetMetadata returns the blob's properties, HTTP headers, and metadata
get, err := blobURL.GetProperties(ctx, azblob.BlobAccessConditions{})
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, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}

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

type BlobHierarchyListSegment Uses

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    []BlobItem   `xml:"Blob"`
}

BlobHierarchyListSegment ...

type BlobItem Uses

type BlobItem 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"`
    Properties BlobProperties `xml:"Properties"`
    Metadata   Metadata       `xml:"Metadata"`
}

BlobItem - An Azure Storage blob

type BlobListingDetails Uses

type BlobListingDetails struct {
    Copy, Metadata, Snapshots, UncommittedBlobs, Deleted bool
}

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

type BlobPrefix Uses

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

BlobPrefix ...

type BlobProperties Uses

type BlobProperties 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', 'AccessTierP20', 'AccessTierP30', 'AccessTierP40', 'AccessTierP50', 'AccessTierHot', 'AccessTierCool', 'AccessTierArchive', 'AccessTierNone'
    AccessTier         AccessTierType `xml:"AccessTier"`
    AccessTierInferred *bool          `xml:"AccessTierInferred"`
    // ArchiveStatus - Possible values include: 'ArchiveStatusRehydratePendingToHot', 'ArchiveStatusRehydratePendingToCool', 'ArchiveStatusNone'
    ArchiveStatus        ArchiveStatusType `xml:"ArchiveStatus"`
    AccessTierChangeTime *time.Time        `xml:"AccessTierChangeTime"`
}

BlobProperties - Properties of a blob

func (BlobProperties) MarshalXML Uses

func (bp BlobProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for BlobProperties.

func (*BlobProperties) UnmarshalXML Uses

func (bp *BlobProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements the xml.Unmarshaler interface for BlobProperties.

type BlobReleaseLeaseResponse Uses

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

BlobReleaseLeaseResponse ...

func (BlobReleaseLeaseResponse) Date Uses

func (brlr BlobReleaseLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (BlobReleaseLeaseResponse) ETag Uses

func (brlr BlobReleaseLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobReleaseLeaseResponse) ErrorCode Uses

func (brlr BlobReleaseLeaseResponse) ErrorCode() string

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

func (BlobReleaseLeaseResponse) LastModified Uses

func (brlr BlobReleaseLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobReleaseLeaseResponse) RequestID Uses

func (brlr BlobReleaseLeaseResponse) RequestID() string

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

func (BlobReleaseLeaseResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobReleaseLeaseResponse) Status Uses

func (brlr BlobReleaseLeaseResponse) Status() string

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

func (BlobReleaseLeaseResponse) StatusCode Uses

func (brlr BlobReleaseLeaseResponse) StatusCode() int

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

func (BlobReleaseLeaseResponse) Version Uses

func (brlr BlobReleaseLeaseResponse) Version() string

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

type BlobRenewLeaseResponse Uses

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

BlobRenewLeaseResponse ...

func (BlobRenewLeaseResponse) Date Uses

func (brlr BlobRenewLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (BlobRenewLeaseResponse) ETag Uses

func (brlr BlobRenewLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobRenewLeaseResponse) ErrorCode Uses

func (brlr BlobRenewLeaseResponse) ErrorCode() string

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

func (BlobRenewLeaseResponse) LastModified Uses

func (brlr BlobRenewLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobRenewLeaseResponse) LeaseID Uses

func (brlr BlobRenewLeaseResponse) LeaseID() string

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

func (BlobRenewLeaseResponse) RequestID Uses

func (brlr BlobRenewLeaseResponse) RequestID() string

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

func (BlobRenewLeaseResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobRenewLeaseResponse) Status Uses

func (brlr BlobRenewLeaseResponse) Status() string

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

func (BlobRenewLeaseResponse) StatusCode Uses

func (brlr BlobRenewLeaseResponse) StatusCode() int

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

func (BlobRenewLeaseResponse) Version Uses

func (brlr BlobRenewLeaseResponse) Version() string

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

type BlobSASPermissions Uses

type BlobSASPermissions struct{ Read, Add, Create, Write, Delete 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 Uses

func (p *BlobSASPermissions) Parse(s string) error

Parse initializes the BlobSASPermissions's fields from a string.

func (BlobSASPermissions) String Uses

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 Uses

type BlobSASSignatureValues struct {
    Version            string      `param:"sv"`  // If not specified, this defaults to SASVersion
    Protocol           SASProtocol `param:"spr"` // See the SASProtocol* constants
    StartTime          time.Time   `param:"st"`  // Not specified if IsZero
    ExpiryTime         time.Time   `param:"se"`  // Not specified if IsZero
    SnapshotTime       time.Time
    Permissions        string  `param:"sp"` // Create by initializing a ContainerSASPermissions or BlobSASPermissions and then call String()
    IPRange            IPRange `param:"sip"`
    Identifier         string  `param:"si"`
    ContainerName      string
    BlobName           string // Use "" to create a Container SAS
    CacheControl       string // rscc
    ContentDisposition string // rscd
    ContentEncoding    string // rsce
    ContentLanguage    string // rscl
    ContentType        string // rsct
}

BlobSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage container or blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/constructing-a-service-sas

This example shows how to create and use a Blob Service Shared Access Signature (SAS).

Code:

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

// Use your Storage account's name and key to create a credential object; this is required to sign a SAS.
credential, err := azblob.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 := azblob.BlobSASSignatureValues{
    Protocol:      azblob.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: azblob.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 := azblob.NewBlobURL(*u, azblob.NewPipeline(azblob.NewAnonymousCredential(), azblob.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 := azblob.NewBlobURLParts(blobURL.URL())
fmt.Printf("SAS expiry time=%v", blobURLParts.SAS.ExpiryTime())

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

func (BlobSASSignatureValues) NewSASQueryParameters Uses

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 BlobSetHTTPHeadersResponse Uses

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

BlobSetHTTPHeadersResponse ...

func (BlobSetHTTPHeadersResponse) BlobSequenceNumber Uses

func (bshhr BlobSetHTTPHeadersResponse) BlobSequenceNumber() int64

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

func (BlobSetHTTPHeadersResponse) Date Uses

func (bshhr BlobSetHTTPHeadersResponse) Date() time.Time

Date returns the value for header Date.

func (BlobSetHTTPHeadersResponse) ETag Uses

func (bshhr BlobSetHTTPHeadersResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobSetHTTPHeadersResponse) ErrorCode Uses

func (bshhr BlobSetHTTPHeadersResponse) ErrorCode() string

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

func (BlobSetHTTPHeadersResponse) LastModified Uses

func (bshhr BlobSetHTTPHeadersResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobSetHTTPHeadersResponse) RequestID Uses

func (bshhr BlobSetHTTPHeadersResponse) RequestID() string

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

func (BlobSetHTTPHeadersResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobSetHTTPHeadersResponse) Status Uses

func (bshhr BlobSetHTTPHeadersResponse) Status() string

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

func (BlobSetHTTPHeadersResponse) StatusCode Uses

func (bshhr BlobSetHTTPHeadersResponse) StatusCode() int

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

func (BlobSetHTTPHeadersResponse) Version Uses

func (bshhr BlobSetHTTPHeadersResponse) Version() string

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

type BlobSetMetadataResponse Uses

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

BlobSetMetadataResponse ...

func (BlobSetMetadataResponse) Date Uses

func (bsmr BlobSetMetadataResponse) Date() time.Time

Date returns the value for header Date.

func (BlobSetMetadataResponse) ETag Uses

func (bsmr BlobSetMetadataResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobSetMetadataResponse) ErrorCode Uses

func (bsmr BlobSetMetadataResponse) ErrorCode() string

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

func (BlobSetMetadataResponse) IsServerEncrypted Uses

func (bsmr BlobSetMetadataResponse) IsServerEncrypted() string

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

func (BlobSetMetadataResponse) LastModified Uses

func (bsmr BlobSetMetadataResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobSetMetadataResponse) RequestID Uses

func (bsmr BlobSetMetadataResponse) RequestID() string

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

func (BlobSetMetadataResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobSetMetadataResponse) Status Uses

func (bsmr BlobSetMetadataResponse) Status() string

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

func (BlobSetMetadataResponse) StatusCode Uses

func (bsmr BlobSetMetadataResponse) StatusCode() int

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

func (BlobSetMetadataResponse) Version Uses

func (bsmr BlobSetMetadataResponse) Version() string

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

type BlobSetTierResponse Uses

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

BlobSetTierResponse ...

func (BlobSetTierResponse) ErrorCode Uses

func (bstr BlobSetTierResponse) ErrorCode() string

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

func (BlobSetTierResponse) RequestID Uses

func (bstr BlobSetTierResponse) RequestID() string

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

func (BlobSetTierResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobSetTierResponse) Status Uses

func (bstr BlobSetTierResponse) Status() string

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

func (BlobSetTierResponse) StatusCode Uses

func (bstr BlobSetTierResponse) StatusCode() int

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

func (BlobSetTierResponse) Version Uses

func (bstr BlobSetTierResponse) Version() string

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

type BlobStartCopyFromURLResponse Uses

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

BlobStartCopyFromURLResponse ...

func (BlobStartCopyFromURLResponse) CopyID Uses

func (bscfur BlobStartCopyFromURLResponse) CopyID() string

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

func (BlobStartCopyFromURLResponse) CopyStatus Uses

func (bscfur BlobStartCopyFromURLResponse) CopyStatus() CopyStatusType

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

func (BlobStartCopyFromURLResponse) Date Uses

func (bscfur BlobStartCopyFromURLResponse) Date() time.Time

Date returns the value for header Date.

func (BlobStartCopyFromURLResponse) ETag Uses

func (bscfur BlobStartCopyFromURLResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlobStartCopyFromURLResponse) ErrorCode Uses

func (bscfur BlobStartCopyFromURLResponse) ErrorCode() string

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

func (BlobStartCopyFromURLResponse) LastModified Uses

func (bscfur BlobStartCopyFromURLResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlobStartCopyFromURLResponse) RequestID Uses

func (bscfur BlobStartCopyFromURLResponse) RequestID() string

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

func (BlobStartCopyFromURLResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobStartCopyFromURLResponse) Status Uses

func (bscfur BlobStartCopyFromURLResponse) Status() string

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

func (BlobStartCopyFromURLResponse) StatusCode Uses

func (bscfur BlobStartCopyFromURLResponse) StatusCode() int

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

func (BlobStartCopyFromURLResponse) Version Uses

func (bscfur BlobStartCopyFromURLResponse) Version() string

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

type BlobType Uses

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 Uses

func PossibleBlobTypeValues() []BlobType

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

type BlobURL Uses

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.

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

Code:

// 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 := azblob.NewSharedKeyCredential(accountName, accountKey)
if err != nil {
    log.Fatal(err)
}
blobURL := azblob.NewBlobURL(*u, azblob.NewPipeline(credential, azblob.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, azblob.ModifiedAccessConditions{}, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}

copyID := startCopy.CopyID()
copyStatus := startCopy.CopyStatus()
for copyStatus == azblob.CopyStatusPending {
    time.Sleep(time.Second * 2)
    getMetadata, err := blobURL.GetProperties(ctx, azblob.BlobAccessConditions{})
    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)

func NewBlobURL Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

func (b BlobURL) CreateSnapshot(ctx context.Context, metadata Metadata, ac BlobAccessConditions) (*BlobCreateSnapshotResponse, error)

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

func (BlobURL) Delete Uses

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

DeleteBlob marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection. Note that deleting a blob also deletes all its snapshots. For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-blob.

func (BlobURL) Download Uses

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

DownloadBlob 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. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob.

func (BlobURL) GetProperties Uses

func (b BlobURL) GetProperties(ctx context.Context, ac BlobAccessConditions) (*BlobGetPropertiesResponse, error)

GetBlobProperties returns the blob's properties. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-blob-properties.

func (BlobURL) ReleaseLease Uses

func (b BlobURL) ReleaseLease(ctx context.Context, leaseID string, ac ModifiedAccessConditions) (*BlobReleaseLeaseResponse, error)

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

func (BlobURL) RenewLease Uses

func (b BlobURL) RenewLease(ctx context.Context, leaseID string, ac ModifiedAccessConditions) (*BlobRenewLeaseResponse, error)

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

func (BlobURL) SetHTTPHeaders Uses

func (b BlobURL) SetHTTPHeaders(ctx context.Context, h BlobHTTPHeaders, ac BlobAccessConditions) (*BlobSetHTTPHeadersResponse, error)

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

func (BlobURL) SetMetadata Uses

func (b BlobURL) SetMetadata(ctx context.Context, metadata Metadata, ac BlobAccessConditions) (*BlobSetMetadataResponse, error)

SetBlobMetadata changes a blob's metadata. https://docs.microsoft.com/rest/api/storageservices/set-blob-metadata.

func (BlobURL) SetTier Uses

func (b BlobURL) SetTier(ctx context.Context, tier AccessTierType, lac LeaseAccessConditions) (*BlobSetTierResponse, error)

SetTier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. For detailed information about block blob level tiering see https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-storage-tiers.

func (BlobURL) StartCopyFromURL Uses

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

func (b BlobURL) String() string

String returns the URL as a string.

func (BlobURL) ToAppendBlobURL Uses

func (b BlobURL) ToAppendBlobURL() AppendBlobURL

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

func (BlobURL) ToBlockBlobURL Uses

func (b BlobURL) ToBlockBlobURL() BlockBlobURL

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

func (BlobURL) ToPageBlobURL Uses

func (b BlobURL) ToPageBlobURL() PageBlobURL

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

func (BlobURL) URL Uses

func (b BlobURL) URL() url.URL

URL returns the URL endpoint used by the BlobURL object.

func (BlobURL) Undelete Uses

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 Uses

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 Uses

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.

type BlobURLParts Uses

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
}

A BlobURLParts object represents the components that make up an Azure Storage Container/Blob URL. You parse an existing URL into its parts by calling NewBlobURLParts(). You construct a URL from parts by calling URL(). NOTE: Changing any SAS-related field requires computing a new SAS signature.

This example 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.

Code:

// 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 := azblob.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 = azblob.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.

func NewBlobURLParts Uses

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 Uses

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 Uses

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

BlobUndeleteResponse ...

func (BlobUndeleteResponse) Date Uses

func (bur BlobUndeleteResponse) Date() time.Time

Date returns the value for header Date.

func (BlobUndeleteResponse) ErrorCode Uses

func (bur BlobUndeleteResponse) ErrorCode() string

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

func (BlobUndeleteResponse) RequestID Uses

func (bur BlobUndeleteResponse) RequestID() string

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

func (BlobUndeleteResponse) Response Uses

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

Response returns the raw HTTP response object.

func (BlobUndeleteResponse) Status Uses

func (bur BlobUndeleteResponse) Status() string

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

func (BlobUndeleteResponse) StatusCode Uses

func (bur BlobUndeleteResponse) StatusCode() int

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

func (BlobUndeleteResponse) Version Uses

func (bur BlobUndeleteResponse) Version() string

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

type Block Uses

type Block struct {
    // Name - The base64 encoded block ID.
    Name string `xml:"Name"`
    // Size - The block size in bytes.
    Size int32 `xml:"Size"`
}

Block - Represents a single block in a block blob. It describes the block's ID and size.

type BlockBlobCommitBlockListResponse Uses

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

BlockBlobCommitBlockListResponse ...

func (BlockBlobCommitBlockListResponse) ContentMD5 Uses

func (bbcblr BlockBlobCommitBlockListResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (BlockBlobCommitBlockListResponse) Date Uses

func (bbcblr BlockBlobCommitBlockListResponse) Date() time.Time

Date returns the value for header Date.

func (BlockBlobCommitBlockListResponse) ETag Uses

func (bbcblr BlockBlobCommitBlockListResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlockBlobCommitBlockListResponse) ErrorCode Uses

func (bbcblr BlockBlobCommitBlockListResponse) ErrorCode() string

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

func (BlockBlobCommitBlockListResponse) IsServerEncrypted Uses

func (bbcblr BlockBlobCommitBlockListResponse) IsServerEncrypted() string

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

func (BlockBlobCommitBlockListResponse) LastModified Uses

func (bbcblr BlockBlobCommitBlockListResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlockBlobCommitBlockListResponse) RequestID Uses

func (bbcblr BlockBlobCommitBlockListResponse) RequestID() string

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

func (BlockBlobCommitBlockListResponse) Response Uses

func (bbcblr BlockBlobCommitBlockListResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlockBlobCommitBlockListResponse) Status Uses

func (bbcblr BlockBlobCommitBlockListResponse) Status() string

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

func (BlockBlobCommitBlockListResponse) StatusCode Uses

func (bbcblr BlockBlobCommitBlockListResponse) StatusCode() int

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

func (BlockBlobCommitBlockListResponse) Version Uses

func (bbcblr BlockBlobCommitBlockListResponse) Version() string

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

type BlockBlobStageBlockFromURLResponse Uses

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

BlockBlobStageBlockFromURLResponse ...

func (BlockBlobStageBlockFromURLResponse) ContentMD5 Uses

func (bbsbfur BlockBlobStageBlockFromURLResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (BlockBlobStageBlockFromURLResponse) Date Uses

func (bbsbfur BlockBlobStageBlockFromURLResponse) Date() time.Time

Date returns the value for header Date.

func (BlockBlobStageBlockFromURLResponse) ErrorCode Uses

func (bbsbfur BlockBlobStageBlockFromURLResponse) ErrorCode() string

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

func (BlockBlobStageBlockFromURLResponse) IsServerEncrypted Uses

func (bbsbfur BlockBlobStageBlockFromURLResponse) IsServerEncrypted() string

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

func (BlockBlobStageBlockFromURLResponse) RequestID Uses

func (bbsbfur BlockBlobStageBlockFromURLResponse) RequestID() string

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

func (BlockBlobStageBlockFromURLResponse) Response Uses

func (bbsbfur BlockBlobStageBlockFromURLResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlockBlobStageBlockFromURLResponse) Status Uses

func (bbsbfur BlockBlobStageBlockFromURLResponse) Status() string

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

func (BlockBlobStageBlockFromURLResponse) StatusCode Uses

func (bbsbfur BlockBlobStageBlockFromURLResponse) StatusCode() int

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

func (BlockBlobStageBlockFromURLResponse) Version Uses

func (bbsbfur BlockBlobStageBlockFromURLResponse) Version() string

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

type BlockBlobStageBlockResponse Uses

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

BlockBlobStageBlockResponse ...

func (BlockBlobStageBlockResponse) ContentMD5 Uses

func (bbsbr BlockBlobStageBlockResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (BlockBlobStageBlockResponse) Date Uses

func (bbsbr BlockBlobStageBlockResponse) Date() time.Time

Date returns the value for header Date.

func (BlockBlobStageBlockResponse) ErrorCode Uses

func (bbsbr BlockBlobStageBlockResponse) ErrorCode() string

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

func (BlockBlobStageBlockResponse) IsServerEncrypted Uses

func (bbsbr BlockBlobStageBlockResponse) IsServerEncrypted() string

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

func (BlockBlobStageBlockResponse) RequestID Uses

func (bbsbr BlockBlobStageBlockResponse) RequestID() string

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

func (BlockBlobStageBlockResponse) Response Uses

func (bbsbr BlockBlobStageBlockResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlockBlobStageBlockResponse) Status Uses

func (bbsbr BlockBlobStageBlockResponse) Status() string

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

func (BlockBlobStageBlockResponse) StatusCode Uses

func (bbsbr BlockBlobStageBlockResponse) StatusCode() int

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

func (BlockBlobStageBlockResponse) Version Uses

func (bbsbr BlockBlobStageBlockResponse) Version() string

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

type BlockBlobURL Uses

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

BlockBlobURL defines a set of operations applicable to block blobs.

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

Code:

// 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/MyBlockBlob.txt", accountName))
credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
if err != nil {
    log.Fatal(err)
}
blobURL := azblob.NewBlockBlobURL(*u, azblob.NewPipeline(credential, azblob.PipelineOptions{}))

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

// These helper functions convert a binary block ID to a base-64 string and vice versa
// NOTE: The blockID must be <= 64 bytes and ALL blockIDs for the block must be the same length
blockIDBinaryToBase64 := func(blockID []byte) string { return base64.StdEncoding.EncodeToString(blockID) }
blockIDBase64ToBinary := func(blockID string) []byte { binary, _ := base64.StdEncoding.DecodeString(blockID); return binary }

// These helper functions convert an int block ID to a base-64 string and vice versa
blockIDIntToBase64 := func(blockID int) string {
    binaryBlockID := (&[4]byte{})[:] // All block IDs are 4 bytes long
    binary.LittleEndian.PutUint32(binaryBlockID, uint32(blockID))
    return blockIDBinaryToBase64(binaryBlockID)
}
blockIDBase64ToInt := func(blockID string) int {
    blockIDBase64ToBinary(blockID)
    return int(binary.LittleEndian.Uint32(blockIDBase64ToBinary(blockID)))
}

// Upload 4 blocks to the blob (these blocks are tiny; they can be up to 100MB each)
words := []string{"Azure ", "Storage ", "Block ", "Blob."}
base64BlockIDs := make([]string, len(words)) // The collection of block IDs (base 64 strings)

// Upload each block sequentially (one after the other); for better performance, you want to upload multiple blocks in parallel)
for index, word := range words {
    // This example uses the index as the block ID; convert the index/ID into a base-64 encoded string as required by the service.
    // NOTE: Over the lifetime of a blob, all block IDs (before base 64 encoding) must be the same length (this example uses 4 byte block IDs).
    base64BlockIDs[index] = blockIDIntToBase64(index) // Some people use UUIDs for block IDs

    // Upload a block to this blob specifying the Block ID and its content (up to 100MB); this block is uncommitted.
    _, err := blobURL.StageBlock(ctx, base64BlockIDs[index], strings.NewReader(word), azblob.LeaseAccessConditions{}, nil)
    if err != nil {
        log.Fatal(err)
    }
}

// After all the blocks are uploaded, atomically commit them to the blob.
_, err = blobURL.CommitBlockList(ctx, base64BlockIDs, azblob.BlobHTTPHeaders{}, azblob.Metadata{}, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}

// For the blob, show each block (ID and size) that is a committed part of it.
getBlock, err := blobURL.GetBlockList(ctx, azblob.BlockListAll, azblob.LeaseAccessConditions{})
if err != nil {
    log.Fatal(err)
}
for _, block := range getBlock.CommittedBlocks {
    fmt.Printf("Block ID=%d, Size=%d\n", blockIDBase64ToInt(block.Name), block.Size)
}

// Download the blob in its entirety; download operations do not take blocks into account.
// NOTE: For really large blobs, downloading them like allocates a lot of memory.
get, err := blobURL.Download(ctx, 0, 0, azblob.BlobAccessConditions{}, false)
if err != nil {
    log.Fatal(err)
}
blobData := &bytes.Buffer{}
reader := get.Body(azblob.RetryReaderOptions{})
blobData.ReadFrom(reader)
reader.Close() // The client must close the response body when finished with it
fmt.Println(blobData)

func NewBlockBlobURL Uses

func NewBlockBlobURL(url url.URL, p pipeline.Pipeline) BlockBlobURL

NewBlockBlobURL creates a BlockBlobURL object using the specified URL and request policy pipeline.

func (BlockBlobURL) CommitBlockList Uses

func (bb BlockBlobURL) CommitBlockList(ctx context.Context, base64BlockIDs []string, h BlobHTTPHeaders,
    metadata Metadata, ac BlobAccessConditions) (*BlockBlobCommitBlockListResponse, error)

CommitBlockList writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior PutBlock operation. You can call PutBlockList to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. Any blocks not specified in the block list and permanently deleted. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-block-list.

func (BlockBlobURL) GetBlockList Uses

func (bb BlockBlobURL) GetBlockList(ctx context.Context, listType BlockListType, ac LeaseAccessConditions) (*BlockList, error)

GetBlockList returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-block-list.

func (BlockBlobURL) StageBlock Uses

func (bb BlockBlobURL) StageBlock(ctx context.Context, base64BlockID string, body io.ReadSeeker, ac LeaseAccessConditions, transactionalMD5 []byte) (*BlockBlobStageBlockResponse, error)

StageBlock uploads the specified block to the block blob's "staging area" to be later committed by a call to CommitBlockList. Note that the http client closes the body stream after the request is sent to the service. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-block.

func (BlockBlobURL) StageBlockFromURL Uses

func (bb BlockBlobURL) StageBlockFromURL(ctx context.Context, base64BlockID string, sourceURL url.URL, offset int64, count int64, destinationAccessConditions LeaseAccessConditions, sourceAccessConditions ModifiedAccessConditions) (*BlockBlobStageBlockFromURLResponse, error)

StageBlockFromURL copies the specified block from a source URL to the block blob's "staging area" to be later committed by a call to CommitBlockList. If count is CountToEnd (0), then data is read from specified offset to the end. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/put-block-from-url.

func (BlockBlobURL) Upload Uses

func (bb BlockBlobURL) Upload(ctx context.Context, body io.ReadSeeker, h BlobHTTPHeaders, metadata Metadata, ac BlobAccessConditions) (*BlockBlobUploadResponse, error)

Upload creates a new block blob or overwrites an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not supported with Upload; the content of the existing blob is overwritten with the new content. To perform a partial update of a block blob, use StageBlock and CommitBlockList. This method panics if the stream is not at position 0. Note that the http client closes the body stream after the request is sent to the service. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.

func (BlockBlobURL) WithPipeline Uses

func (bb BlockBlobURL) WithPipeline(p pipeline.Pipeline) BlockBlobURL

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

func (BlockBlobURL) WithSnapshot Uses

func (bb BlockBlobURL) WithSnapshot(snapshot string) BlockBlobURL

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

type BlockBlobUploadResponse Uses

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

BlockBlobUploadResponse ...

func (BlockBlobUploadResponse) ContentMD5 Uses

func (bbur BlockBlobUploadResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (BlockBlobUploadResponse) Date Uses

func (bbur BlockBlobUploadResponse) Date() time.Time

Date returns the value for header Date.

func (BlockBlobUploadResponse) ETag Uses

func (bbur BlockBlobUploadResponse) ETag() ETag

ETag returns the value for header ETag.

func (BlockBlobUploadResponse) ErrorCode Uses

func (bbur BlockBlobUploadResponse) ErrorCode() string

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

func (BlockBlobUploadResponse) IsServerEncrypted Uses

func (bbur BlockBlobUploadResponse) IsServerEncrypted() string

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

func (BlockBlobUploadResponse) LastModified Uses

func (bbur BlockBlobUploadResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlockBlobUploadResponse) RequestID Uses

func (bbur BlockBlobUploadResponse) RequestID() string

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

func (BlockBlobUploadResponse) Response Uses

func (bbur BlockBlobUploadResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (BlockBlobUploadResponse) Status Uses

func (bbur BlockBlobUploadResponse) Status() string

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

func (BlockBlobUploadResponse) StatusCode Uses

func (bbur BlockBlobUploadResponse) StatusCode() int

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

func (BlockBlobUploadResponse) Version Uses

func (bbur BlockBlobUploadResponse) Version() string

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

type BlockID Uses

type BlockID [64]byte

func (*BlockID) FromBase64 Uses

func (blockID *BlockID) FromBase64(s string) error

func (BlockID) ToBase64 Uses

func (blockID BlockID) ToBase64() string

type BlockList Uses

type BlockList struct {
    CommittedBlocks   []Block `xml:"CommittedBlocks>Block"`
    UncommittedBlocks []Block `xml:"UncommittedBlocks>Block"`
    // contains filtered or unexported fields
}

BlockList ...

func (BlockList) BlobContentLength Uses

func (bl BlockList) BlobContentLength() int64

BlobContentLength returns the value for header x-ms-blob-content-length.

func (BlockList) ContentType Uses

func (bl BlockList) ContentType() string

ContentType returns the value for header Content-Type.

func (BlockList) Date Uses

func (bl BlockList) Date() time.Time

Date returns the value for header Date.

func (BlockList) ETag Uses

func (bl BlockList) ETag() ETag

ETag returns the value for header ETag.

func (BlockList) ErrorCode Uses

func (bl BlockList) ErrorCode() string

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

func (BlockList) LastModified Uses

func (bl BlockList) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (BlockList) RequestID Uses

func (bl BlockList) RequestID() string

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

func (BlockList) Response Uses

func (bl BlockList) Response() *http.Response

Response returns the raw HTTP response object.

func (BlockList) Status Uses

func (bl BlockList) Status() string

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

func (BlockList) StatusCode Uses

func (bl BlockList) StatusCode() int

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

func (BlockList) Version Uses

func (bl BlockList) Version() string

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

type BlockListType Uses

type BlockListType string

BlockListType enumerates the values for block list type.

const (
    // BlockListAll ...
    BlockListAll BlockListType = "all"
    // BlockListCommitted ...
    BlockListCommitted BlockListType = "committed"
    // BlockListNone represents an empty BlockListType.
    BlockListNone BlockListType = ""
    // BlockListUncommitted ...
    BlockListUncommitted BlockListType = "uncommitted"
)

func PossibleBlockListTypeValues Uses

func PossibleBlockListTypeValues() []BlockListType

PossibleBlockListTypeValues returns an array of possible values for the BlockListType const type.

type BlockLookupList Uses

type BlockLookupList struct {
    // XMLName is used for marshalling and is subject to removal in a future release.
    XMLName     xml.Name `xml:"BlockList"`
    Committed   []string `xml:"Committed"`
    Uncommitted []string `xml:"Uncommitted"`
    Latest      []string `xml:"Latest"`
}

BlockLookupList ...

type ClearRange Uses

type ClearRange struct {
    Start int64 `xml:"Start"`
    End   int64 `xml:"End"`
}

ClearRange ...

type CommonResponse Uses

type CommonResponse interface {
    // ETag returns the value for header ETag.
    ETag() ETag

    // LastModified returns the value for header Last-Modified.
    LastModified() time.Time

    // RequestID returns the value for header x-ms-request-id.
    RequestID() string

    // Date returns the value for header Date.
    Date() time.Time

    // Version returns the value for header x-ms-version.
    Version() string

    // Response returns the raw HTTP response object.
    Response() *http.Response
}

CommonResponse returns the headers common to all blob REST API responses.

func UploadBufferToBlockBlob Uses

func UploadBufferToBlockBlob(ctx context.Context, b []byte,
    blockBlobURL BlockBlobURL, o UploadToBlockBlobOptions) (CommonResponse, error)

UploadBufferToBlockBlob uploads a buffer in blocks to a block blob.

func UploadFileToBlockBlob Uses

func UploadFileToBlockBlob(ctx context.Context, file *os.File,
    blockBlobURL BlockBlobURL, o UploadToBlockBlobOptions) (CommonResponse, error)

UploadFileToBlockBlob uploads a file in blocks to a block blob.

func UploadStreamToBlockBlob Uses

func UploadStreamToBlockBlob(ctx context.Context, reader io.Reader, blockBlobURL BlockBlobURL,
    o UploadStreamToBlockBlobOptions) (CommonResponse, error)

Code:

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

// Create a BlockBlobURL object to a blob in the container (we assume the container already exists).
u, _ := url.Parse(fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer/BigBlockBlob.bin", accountName))
credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
if err != nil {
    log.Fatal(err)
}
blockBlobURL := azblob.NewBlockBlobURL(*u, azblob.NewPipeline(credential, azblob.PipelineOptions{}))

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

// Create some data to test the upload stream
blobSize := 8 * 1024 * 1024
data := make([]byte, blobSize)
rand.Read(data)

// Perform UploadStreamToBlockBlob
bufferSize := 2 * 1024 * 1024 // Configure the size of the rotating buffers that are used when uploading
maxBuffers := 3               // Configure the number of rotating buffers that are used when uploading
_, err = azblob.UploadStreamToBlockBlob(ctx, bytes.NewReader(data), blockBlobURL,
    azblob.UploadStreamToBlockBlobOptions{BufferSize: bufferSize, MaxBuffers: maxBuffers})

// Verify that upload was successful
if err != nil {
    log.Fatal(err)
}

type ContainerAccessConditions Uses

type ContainerAccessConditions struct {
    ModifiedAccessConditions
    LeaseAccessConditions
}

ContainerAccessConditions identifies container-specific access conditions which you optionally set.

type ContainerAcquireLeaseResponse Uses

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

ContainerAcquireLeaseResponse ...

func (ContainerAcquireLeaseResponse) Date Uses

func (calr ContainerAcquireLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (ContainerAcquireLeaseResponse) ETag Uses

func (calr ContainerAcquireLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (ContainerAcquireLeaseResponse) ErrorCode Uses

func (calr ContainerAcquireLeaseResponse) ErrorCode() string

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

func (ContainerAcquireLeaseResponse) LastModified Uses

func (calr ContainerAcquireLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (ContainerAcquireLeaseResponse) LeaseID Uses

func (calr ContainerAcquireLeaseResponse) LeaseID() string

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

func (ContainerAcquireLeaseResponse) RequestID Uses

func (calr ContainerAcquireLeaseResponse) RequestID() string

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

func (ContainerAcquireLeaseResponse) Response Uses

func (calr ContainerAcquireLeaseResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ContainerAcquireLeaseResponse) Status Uses

func (calr ContainerAcquireLeaseResponse) Status() string

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

func (ContainerAcquireLeaseResponse) StatusCode Uses

func (calr ContainerAcquireLeaseResponse) StatusCode() int

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

func (ContainerAcquireLeaseResponse) Version Uses

func (calr ContainerAcquireLeaseResponse) Version() string

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

type ContainerBreakLeaseResponse Uses

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

ContainerBreakLeaseResponse ...

func (ContainerBreakLeaseResponse) Date Uses

func (cblr ContainerBreakLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (ContainerBreakLeaseResponse) ETag Uses

func (cblr ContainerBreakLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (ContainerBreakLeaseResponse) ErrorCode Uses

func (cblr ContainerBreakLeaseResponse) ErrorCode() string

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

func (ContainerBreakLeaseResponse) LastModified Uses

func (cblr ContainerBreakLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (ContainerBreakLeaseResponse) LeaseTime Uses

func (cblr ContainerBreakLeaseResponse) LeaseTime() int32

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

func (ContainerBreakLeaseResponse) RequestID Uses

func (cblr ContainerBreakLeaseResponse) RequestID() string

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

func (ContainerBreakLeaseResponse) Response Uses

func (cblr ContainerBreakLeaseResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ContainerBreakLeaseResponse) Status Uses

func (cblr ContainerBreakLeaseResponse) Status() string

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

func (ContainerBreakLeaseResponse) StatusCode Uses

func (cblr ContainerBreakLeaseResponse) StatusCode() int

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

func (ContainerBreakLeaseResponse) Version Uses

func (cblr ContainerBreakLeaseResponse) Version() string

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

type ContainerChangeLeaseResponse Uses

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

ContainerChangeLeaseResponse ...

func (ContainerChangeLeaseResponse) Date Uses

func (cclr ContainerChangeLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (ContainerChangeLeaseResponse) ETag Uses

func (cclr ContainerChangeLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (ContainerChangeLeaseResponse) ErrorCode Uses

func (cclr ContainerChangeLeaseResponse) ErrorCode() string

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

func (ContainerChangeLeaseResponse) LastModified Uses

func (cclr ContainerChangeLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (ContainerChangeLeaseResponse) LeaseID Uses

func (cclr ContainerChangeLeaseResponse) LeaseID() string

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

func (ContainerChangeLeaseResponse) RequestID Uses

func (cclr ContainerChangeLeaseResponse) RequestID() string

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

func (ContainerChangeLeaseResponse) Response Uses

func (cclr ContainerChangeLeaseResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ContainerChangeLeaseResponse) Status Uses

func (cclr ContainerChangeLeaseResponse) Status() string

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

func (ContainerChangeLeaseResponse) StatusCode Uses

func (cclr ContainerChangeLeaseResponse) StatusCode() int

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

func (ContainerChangeLeaseResponse) Version Uses

func (cclr ContainerChangeLeaseResponse) Version() string

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

type ContainerCreateResponse Uses

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

ContainerCreateResponse ...

func (ContainerCreateResponse) Date Uses

func (ccr ContainerCreateResponse) Date() time.Time

Date returns the value for header Date.

func (ContainerCreateResponse) ETag Uses

func (ccr ContainerCreateResponse) ETag() ETag

ETag returns the value for header ETag.

func (ContainerCreateResponse) ErrorCode Uses

func (ccr ContainerCreateResponse) ErrorCode() string

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

func (ContainerCreateResponse) LastModified Uses

func (ccr ContainerCreateResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (ContainerCreateResponse) RequestID Uses

func (ccr ContainerCreateResponse) RequestID() string

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

func (ContainerCreateResponse) Response Uses

func (ccr ContainerCreateResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ContainerCreateResponse) Status Uses

func (ccr ContainerCreateResponse) Status() string

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

func (ContainerCreateResponse) StatusCode Uses

func (ccr ContainerCreateResponse) StatusCode() int

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

func (ContainerCreateResponse) Version Uses

func (ccr ContainerCreateResponse) Version() string

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

type ContainerDeleteResponse Uses

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

ContainerDeleteResponse ...

func (ContainerDeleteResponse) Date Uses

func (cdr ContainerDeleteResponse) Date() time.Time

Date returns the value for header Date.

func (ContainerDeleteResponse) ErrorCode Uses

func (cdr ContainerDeleteResponse) ErrorCode() string

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

func (ContainerDeleteResponse) RequestID Uses

func (cdr ContainerDeleteResponse) RequestID() string

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

func (ContainerDeleteResponse) Response Uses

func (cdr ContainerDeleteResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ContainerDeleteResponse) Status Uses

func (cdr ContainerDeleteResponse) Status() string

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

func (ContainerDeleteResponse) StatusCode Uses

func (cdr ContainerDeleteResponse) StatusCode() int

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

func (ContainerDeleteResponse) Version Uses

func (cdr ContainerDeleteResponse) Version() string

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

type ContainerGetAccountInfoResponse Uses

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

ContainerGetAccountInfoResponse ...

func (ContainerGetAccountInfoResponse) AccountKind Uses

func (cgair ContainerGetAccountInfoResponse) AccountKind() AccountKindType

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

func (ContainerGetAccountInfoResponse) Date Uses

func (cgair ContainerGetAccountInfoResponse) Date() time.Time

Date returns the value for header Date.

func (ContainerGetAccountInfoResponse) ErrorCode Uses

func (cgair ContainerGetAccountInfoResponse) ErrorCode() string

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

func (ContainerGetAccountInfoResponse) RequestID Uses

func (cgair ContainerGetAccountInfoResponse) RequestID() string

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

func (ContainerGetAccountInfoResponse) Response Uses

func (cgair ContainerGetAccountInfoResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ContainerGetAccountInfoResponse) SkuName Uses

func (cgair ContainerGetAccountInfoResponse) SkuName() SkuNameType

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

func (ContainerGetAccountInfoResponse) Status Uses

func (cgair ContainerGetAccountInfoResponse) Status() string

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

func (ContainerGetAccountInfoResponse) StatusCode Uses

func (cgair ContainerGetAccountInfoResponse) StatusCode() int

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

func (ContainerGetAccountInfoResponse) Version Uses

func (cgair ContainerGetAccountInfoResponse) Version() string

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

type ContainerGetPropertiesResponse Uses

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

ContainerGetPropertiesResponse ...

func (ContainerGetPropertiesResponse) BlobPublicAccess Uses

func (cgpr ContainerGetPropertiesResponse) BlobPublicAccess() PublicAccessType

BlobPublicAccess returns the value for header x-ms-blob-public-access.

func (ContainerGetPropertiesResponse) Date Uses

func (cgpr ContainerGetPropertiesResponse) Date() time.Time

Date returns the value for header Date.

func (ContainerGetPropertiesResponse) ETag Uses

func (cgpr ContainerGetPropertiesResponse) ETag() ETag

ETag returns the value for header ETag.

func (ContainerGetPropertiesResponse) ErrorCode Uses

func (cgpr ContainerGetPropertiesResponse) ErrorCode() string

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

func (ContainerGetPropertiesResponse) HasImmutabilityPolicy Uses

func (cgpr ContainerGetPropertiesResponse) HasImmutabilityPolicy() string

HasImmutabilityPolicy returns the value for header x-ms-has-immutability-policy.

func (ContainerGetPropertiesResponse) HasLegalHold Uses

func (cgpr ContainerGetPropertiesResponse) HasLegalHold() string

HasLegalHold returns the value for header x-ms-has-legal-hold.

func (ContainerGetPropertiesResponse) LastModified Uses

func (cgpr ContainerGetPropertiesResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (ContainerGetPropertiesResponse) LeaseDuration Uses

func (cgpr ContainerGetPropertiesResponse) LeaseDuration() LeaseDurationType

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

func (ContainerGetPropertiesResponse) LeaseState Uses

func (cgpr ContainerGetPropertiesResponse) LeaseState() LeaseStateType

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

func (ContainerGetPropertiesResponse) LeaseStatus Uses

func (cgpr ContainerGetPropertiesResponse) LeaseStatus() LeaseStatusType

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

func (ContainerGetPropertiesResponse) NewMetadata Uses

func (cgpr ContainerGetPropertiesResponse) NewMetadata() Metadata

NewMetadata returns user-defined key/value pairs.

func (ContainerGetPropertiesResponse) RequestID Uses

func (cgpr ContainerGetPropertiesResponse) RequestID() string

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

func (ContainerGetPropertiesResponse) Response Uses

func (cgpr ContainerGetPropertiesResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ContainerGetPropertiesResponse) Status Uses

func (cgpr ContainerGetPropertiesResponse) Status() string

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

func (ContainerGetPropertiesResponse) StatusCode Uses

func (cgpr ContainerGetPropertiesResponse) StatusCode() int

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

func (ContainerGetPropertiesResponse) Version Uses

func (cgpr ContainerGetPropertiesResponse) Version() string

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

type ContainerItem Uses

type ContainerItem struct {
    // XMLName is used for marshalling and is subject to removal in a future release.
    XMLName    xml.Name            `xml:"Container"`
    Name       string              `xml:"Name"`
    Properties ContainerProperties `xml:"Properties"`
    Metadata   Metadata            `xml:"Metadata"`
}

ContainerItem - An Azure Storage container

type ContainerProperties Uses

type ContainerProperties struct {
    LastModified time.Time `xml:"Last-Modified"`
    Etag         ETag      `xml:"Etag"`
    // 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"`
    // PublicAccess - Possible values include: 'PublicAccessContainer', 'PublicAccessBlob', 'PublicAccessNone'
    PublicAccess          PublicAccessType `xml:"PublicAccess"`
    HasImmutabilityPolicy *bool            `xml:"HasImmutabilityPolicy"`
    HasLegalHold          *bool            `xml:"HasLegalHold"`
}

ContainerProperties - Properties of a container

func (ContainerProperties) MarshalXML Uses

func (cp ContainerProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for ContainerProperties.

func (*ContainerProperties) UnmarshalXML Uses

func (cp *ContainerProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements the xml.Unmarshaler interface for ContainerProperties.

type ContainerReleaseLeaseResponse Uses

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

ContainerReleaseLeaseResponse ...

func (ContainerReleaseLeaseResponse) Date Uses

func (crlr ContainerReleaseLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (ContainerReleaseLeaseResponse) ETag Uses

func (crlr ContainerReleaseLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (ContainerReleaseLeaseResponse) ErrorCode Uses

func (crlr ContainerReleaseLeaseResponse) ErrorCode() string

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

func (ContainerReleaseLeaseResponse) LastModified Uses

func (crlr ContainerReleaseLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (ContainerReleaseLeaseResponse) RequestID Uses

func (crlr ContainerReleaseLeaseResponse) RequestID() string

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

func (ContainerReleaseLeaseResponse) Response Uses

func (crlr ContainerReleaseLeaseResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ContainerReleaseLeaseResponse) Status Uses

func (crlr ContainerReleaseLeaseResponse) Status() string

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

func (ContainerReleaseLeaseResponse) StatusCode Uses

func (crlr ContainerReleaseLeaseResponse) StatusCode() int

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

func (ContainerReleaseLeaseResponse) Version Uses

func (crlr ContainerReleaseLeaseResponse) Version() string

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

type ContainerRenewLeaseResponse Uses

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

ContainerRenewLeaseResponse ...

func (ContainerRenewLeaseResponse) Date Uses

func (crlr ContainerRenewLeaseResponse) Date() time.Time

Date returns the value for header Date.

func (ContainerRenewLeaseResponse) ETag Uses

func (crlr ContainerRenewLeaseResponse) ETag() ETag

ETag returns the value for header ETag.

func (ContainerRenewLeaseResponse) ErrorCode Uses

func (crlr ContainerRenewLeaseResponse) ErrorCode() string

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

func (ContainerRenewLeaseResponse) LastModified Uses

func (crlr ContainerRenewLeaseResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (ContainerRenewLeaseResponse) LeaseID Uses

func (crlr ContainerRenewLeaseResponse) LeaseID() string

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

func (ContainerRenewLeaseResponse) RequestID Uses

func (crlr ContainerRenewLeaseResponse) RequestID() string

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

func (ContainerRenewLeaseResponse) Response Uses

func (crlr ContainerRenewLeaseResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ContainerRenewLeaseResponse) Status Uses

func (crlr ContainerRenewLeaseResponse) Status() string

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

func (ContainerRenewLeaseResponse) StatusCode Uses

func (crlr ContainerRenewLeaseResponse) StatusCode() int

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

func (ContainerRenewLeaseResponse) Version Uses

func (crlr ContainerRenewLeaseResponse) Version() string

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

type ContainerSASPermissions Uses

type ContainerSASPermissions struct {
    Read, Add, Create, Write, Delete, List bool
}

The ContainerSASPermissions type simplifies creating the permissions string for an Azure Storage container SAS. Initialize an instance of this type and then call its String method to set BlobSASSignatureValues's Permissions field.

func (*ContainerSASPermissions) Parse Uses

func (p *ContainerSASPermissions) Parse(s string) error

Parse initializes the ContainerSASPermissions's fields from a string.

func (ContainerSASPermissions) String Uses

func (p ContainerSASPermissions) String() string

String produces the SAS permissions string for an Azure Storage container. Call this method to set BlobSASSignatureValues's Permissions field.

type ContainerSetAccessPolicyResponse Uses

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

ContainerSetAccessPolicyResponse ...

func (ContainerSetAccessPolicyResponse) Date Uses

func (csapr ContainerSetAccessPolicyResponse) Date() time.Time

Date returns the value for header Date.

func (ContainerSetAccessPolicyResponse) ETag Uses

func (csapr ContainerSetAccessPolicyResponse) ETag() ETag

ETag returns the value for header ETag.

func (ContainerSetAccessPolicyResponse) ErrorCode Uses

func (csapr ContainerSetAccessPolicyResponse) ErrorCode() string

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

func (ContainerSetAccessPolicyResponse) LastModified Uses

func (csapr ContainerSetAccessPolicyResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (ContainerSetAccessPolicyResponse) RequestID Uses

func (csapr ContainerSetAccessPolicyResponse) RequestID() string

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

func (ContainerSetAccessPolicyResponse) Response Uses

func (csapr ContainerSetAccessPolicyResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ContainerSetAccessPolicyResponse) Status Uses

func (csapr ContainerSetAccessPolicyResponse) Status() string

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

func (ContainerSetAccessPolicyResponse) StatusCode Uses

func (csapr ContainerSetAccessPolicyResponse) StatusCode() int

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

func (ContainerSetAccessPolicyResponse) Version Uses

func (csapr ContainerSetAccessPolicyResponse) Version() string

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

type ContainerSetMetadataResponse Uses

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

ContainerSetMetadataResponse ...

func (ContainerSetMetadataResponse) Date Uses

func (csmr ContainerSetMetadataResponse) Date() time.Time

Date returns the value for header Date.

func (ContainerSetMetadataResponse) ETag Uses

func (csmr ContainerSetMetadataResponse) ETag() ETag

ETag returns the value for header ETag.

func (ContainerSetMetadataResponse) ErrorCode Uses

func (csmr ContainerSetMetadataResponse) ErrorCode() string

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

func (ContainerSetMetadataResponse) LastModified Uses

func (csmr ContainerSetMetadataResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (ContainerSetMetadataResponse) RequestID Uses

func (csmr ContainerSetMetadataResponse) RequestID() string

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

func (ContainerSetMetadataResponse) Response Uses

func (csmr ContainerSetMetadataResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ContainerSetMetadataResponse) Status Uses

func (csmr ContainerSetMetadataResponse) Status() string

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

func (ContainerSetMetadataResponse) StatusCode Uses

func (csmr ContainerSetMetadataResponse) StatusCode() int

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

func (ContainerSetMetadataResponse) Version Uses

func (csmr ContainerSetMetadataResponse) Version() string

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

type ContainerURL Uses

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

A ContainerURL represents a URL to the Azure Storage container allowing you to manipulate its blobs.

func NewContainerURL Uses

func NewContainerURL(url url.URL, p pipeline.Pipeline) ContainerURL

NewContainerURL creates a ContainerURL object using the specified URL and request policy pipeline.

func (ContainerURL) AcquireLease Uses

func (c ContainerURL) AcquireLease(ctx context.Context, proposedID string, duration int32, ac ModifiedAccessConditions) (*ContainerAcquireLeaseResponse, error)

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

func (ContainerURL) BreakLease Uses

func (c ContainerURL) BreakLease(ctx context.Context, period int32, ac ModifiedAccessConditions) (*ContainerBreakLeaseResponse, error)

BreakLease breaks the container's previously-acquired lease (if it exists). For more information, see https://docs.microsoft.com/rest/api/storageservices/lease-container.

func (ContainerURL) ChangeLease Uses

func (c ContainerURL) ChangeLease(ctx context.Context, leaseID string, proposedID string, ac ModifiedAccessConditions) (*ContainerChangeLeaseResponse, error)

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

func (ContainerURL) Create Uses

func (c ContainerURL) Create(ctx context.Context, metadata Metadata, publicAccessType PublicAccessType) (*ContainerCreateResponse, error)

Create creates a new container within a storage account. If a container with the same name already exists, the operation fails. For more information, see https://docs.microsoft.com/rest/api/storageservices/create-container.

func (ContainerURL) Delete Uses

func (c ContainerURL) Delete(ctx context.Context, ac ContainerAccessConditions) (*ContainerDeleteResponse, error)

Delete marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-container.

func (ContainerURL) GetAccessPolicy Uses

func (c ContainerURL) GetAccessPolicy(ctx context.Context, ac LeaseAccessConditions) (*SignedIdentifiers, error)

GetAccessPolicy returns the container's access policy. The access policy indicates whether container's blobs may be accessed publicly. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-container-acl.

func (ContainerURL) GetProperties Uses

func (c ContainerURL) GetProperties(ctx context.Context, ac LeaseAccessConditions) (*ContainerGetPropertiesResponse, error)

GetProperties returns the container's properties. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-container-metadata.

func (ContainerURL) ListBlobsFlatSegment Uses

func (c ContainerURL) ListBlobsFlatSegment(ctx context.Context, marker Marker, o ListBlobsSegmentOptions) (*ListBlobsFlatSegmentResponse, error)

ListBlobsFlatSegment returns a single segment of blobs starting from the specified Marker. Use an empty Marker to start enumeration from the beginning. Blob names are returned in lexicographic order. After getting a segment, process it, and then call ListBlobsFlatSegment again (passing the the previously-returned Marker) to get the next segment. For more information, see https://docs.microsoft.com/rest/api/storageservices/list-blobs.

func (ContainerURL) ListBlobsHierarchySegment Uses

func (c ContainerURL) ListBlobsHierarchySegment(ctx context.Context, marker Marker, delimiter string, o ListBlobsSegmentOptions) (*ListBlobsHierarchySegmentResponse, error)

ListBlobsHierarchySegment returns a single segment of blobs starting from the specified Marker. Use an empty Marker to start enumeration from the beginning. Blob names are returned in lexicographic order. After getting a segment, process it, and then call ListBlobsHierarchicalSegment again (passing the the previously-returned Marker) to get the next segment. For more information, see https://docs.microsoft.com/rest/api/storageservices/list-blobs.

func (ContainerURL) NewAppendBlobURL Uses

func (c ContainerURL) NewAppendBlobURL(blobName string) AppendBlobURL

NewAppendBlobURL creates a new AppendBlobURL object by concatenating blobName to the end of ContainerURL's URL. The new AppendBlobURL uses the same request policy pipeline as the ContainerURL. To change the pipeline, create the AppendBlobURL and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewAppendBlobURL instead of calling this object's NewAppendBlobURL method.

func (ContainerURL) NewBlobURL Uses

func (c ContainerURL) NewBlobURL(blobName string) BlobURL

NewBlobURL creates a new BlobURL object by concatenating blobName to the end of ContainerURL's URL. The new BlobURL uses the same request policy pipeline as the ContainerURL. To change the pipeline, create the BlobURL and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewBlobURL instead of calling this object's NewBlobURL method.

func (ContainerURL) NewBlockBlobURL Uses

func (c ContainerURL) NewBlockBlobURL(blobName string) BlockBlobURL

NewBlockBlobURL creates a new BlockBlobURL object by concatenating blobName to the end of ContainerURL's URL. The new BlockBlobURL uses the same request policy pipeline as the ContainerURL. To change the pipeline, create the BlockBlobURL and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewBlockBlobURL instead of calling this object's NewBlockBlobURL method.

func (ContainerURL) NewPageBlobURL Uses

func (c ContainerURL) NewPageBlobURL(blobName string) PageBlobURL

NewPageBlobURL creates a new PageBlobURL object by concatenating blobName to the end of ContainerURL's URL. The new PageBlobURL uses the same request policy pipeline as the ContainerURL. To change the pipeline, create the PageBlobURL and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewPageBlobURL instead of calling this object's NewPageBlobURL method.

func (ContainerURL) ReleaseLease Uses

func (c ContainerURL) ReleaseLease(ctx context.Context, leaseID string, ac ModifiedAccessConditions) (*ContainerReleaseLeaseResponse, error)

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

func (ContainerURL) RenewLease Uses

func (c ContainerURL) RenewLease(ctx context.Context, leaseID string, ac ModifiedAccessConditions) (*ContainerRenewLeaseResponse, error)

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

func (ContainerURL) SetAccessPolicy Uses

func (c ContainerURL) SetAccessPolicy(ctx context.Context, accessType PublicAccessType, si []SignedIdentifier,
    ac ContainerAccessConditions) (*ContainerSetAccessPolicyResponse, error)

SetAccessPolicy sets the container's permissions. The access policy indicates whether blobs in a container may be accessed publicly. For more information, see https://docs.microsoft.com/rest/api/storageservices/set-container-acl.

func (ContainerURL) SetMetadata Uses

func (c ContainerURL) SetMetadata(ctx context.Context, metadata Metadata, ac ContainerAccessConditions) (*ContainerSetMetadataResponse, error)

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

func (ContainerURL) String Uses

func (c ContainerURL) String() string

String returns the URL as a string.

func (ContainerURL) URL Uses

func (c ContainerURL) URL() url.URL

URL returns the URL endpoint used by the ContainerURL object.

func (ContainerURL) WithPipeline Uses

func (c ContainerURL) WithPipeline(p pipeline.Pipeline) ContainerURL

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

type CopyStatusType Uses

type CopyStatusType string

CopyStatusType enumerates the values for copy status type.

const (
    // CopyStatusAborted ...
    CopyStatusAborted CopyStatusType = "aborted"
    // CopyStatusFailed ...
    CopyStatusFailed CopyStatusType = "failed"
    // CopyStatusNone represents an empty CopyStatusType.
    CopyStatusNone CopyStatusType = ""
    // CopyStatusPending ...
    CopyStatusPending CopyStatusType = "pending"
    // CopyStatusSuccess ...
    CopyStatusSuccess CopyStatusType = "success"
)

func PossibleCopyStatusTypeValues Uses

func PossibleCopyStatusTypeValues() []CopyStatusType

PossibleCopyStatusTypeValues returns an array of possible values for the CopyStatusType const type.

type CorsRule Uses

type CorsRule struct {
    // AllowedOrigins - The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS.
    AllowedOrigins string `xml:"AllowedOrigins"`
    // AllowedMethods - The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated)
    AllowedMethods string `xml:"AllowedMethods"`
    // AllowedHeaders - the request headers that the origin domain may specify on the CORS request.
    AllowedHeaders string `xml:"AllowedHeaders"`
    // ExposedHeaders - The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer
    ExposedHeaders string `xml:"ExposedHeaders"`
    // MaxAgeInSeconds - The maximum amount time that a browser should cache the preflight OPTIONS request.
    MaxAgeInSeconds int32 `xml:"MaxAgeInSeconds"`
}

CorsRule - CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain

type Credential Uses

type Credential interface {
    pipeline.Factory
    // contains filtered or unexported methods
}

Credential represent any credential type; it is used to create a credential policy Factory.

func NewAnonymousCredential Uses

func NewAnonymousCredential() Credential

NewAnonymousCredential creates an anonymous credential for use with HTTP(S) requests that read public resource or for use with Shared Access Signatures (SAS).

type DeleteSnapshotsOptionType Uses

type DeleteSnapshotsOptionType string

DeleteSnapshotsOptionType enumerates the values for delete snapshots option type.

const (
    // DeleteSnapshotsOptionInclude ...
    DeleteSnapshotsOptionInclude DeleteSnapshotsOptionType = "include"
    // DeleteSnapshotsOptionNone represents an empty DeleteSnapshotsOptionType.
    DeleteSnapshotsOptionNone DeleteSnapshotsOptionType = ""
    // DeleteSnapshotsOptionOnly ...
    DeleteSnapshotsOptionOnly DeleteSnapshotsOptionType = "only"
)

func PossibleDeleteSnapshotsOptionTypeValues Uses

func PossibleDeleteSnapshotsOptionTypeValues() []DeleteSnapshotsOptionType

PossibleDeleteSnapshotsOptionTypeValues returns an array of possible values for the DeleteSnapshotsOptionType const type.

type DownloadFromBlobOptions Uses

type DownloadFromBlobOptions struct {
    // BlockSize specifies the block size to use for each parallel download; the default size is BlobDefaultDownloadBlockSize.
    BlockSize int64

    // Progress is a function that is invoked periodically as bytes are received.
    Progress pipeline.ProgressReceiver

    // AccessConditions indicates the access conditions used when making HTTP GET requests against the blob.
    AccessConditions BlobAccessConditions

    // Parallelism indicates the maximum number of blocks to download in parallel (0=default)
    Parallelism uint16

    // RetryReaderOptionsPerBlock is used when downloading each block.
    RetryReaderOptionsPerBlock RetryReaderOptions
}

DownloadFromBlobOptions identifies options used by the DownloadBlobToBuffer and DownloadBlobToFile functions.

type DownloadResponse Uses

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

DownloadResponse wraps AutoRest generated downloadResponse and helps to provide info for retry.

func (DownloadResponse) AcceptRanges Uses

func (r DownloadResponse) AcceptRanges() string

AcceptRanges returns the value for header Accept-Ranges.

func (DownloadResponse) BlobCommittedBlockCount Uses

func (r DownloadResponse) BlobCommittedBlockCount() int32

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

func (DownloadResponse) BlobContentMD5 Uses

func (r DownloadResponse) BlobContentMD5() []byte

BlobContentMD5 returns the value for header x-ms-blob-content-md5.

func (DownloadResponse) BlobSequenceNumber Uses

func (r DownloadResponse) BlobSequenceNumber() int64

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

func (DownloadResponse) BlobType Uses

func (r DownloadResponse) BlobType() BlobType

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

func (*DownloadResponse) Body Uses

func (r *DownloadResponse) Body(o RetryReaderOptions) io.ReadCloser

Body constructs new RetryReader stream for reading data. If a connection failes while reading, it will make additional requests to reestablish a connection and continue reading. Specifying a RetryReaderOption's with MaxRetryRequests set to 0 (the default), returns the original response body and no retries will be performed.

func (DownloadResponse) CacheControl Uses

func (r DownloadResponse) CacheControl() string

CacheControl returns the value for header Cache-Control.

func (DownloadResponse) ContentDisposition Uses

func (r DownloadResponse) ContentDisposition() string

ContentDisposition returns the value for header Content-Disposition.

func (DownloadResponse) ContentEncoding Uses

func (r DownloadResponse) ContentEncoding() string

ContentEncoding returns the value for header Content-Encoding.

func (DownloadResponse) ContentLanguage Uses

func (r DownloadResponse) ContentLanguage() string

ContentLanguage returns the value for header Content-Language.

func (DownloadResponse) ContentLength Uses

func (r DownloadResponse) ContentLength() int64

ContentLength returns the value for header Content-Length.

func (DownloadResponse) ContentMD5 Uses

func (r DownloadResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (DownloadResponse) ContentRange Uses

func (r DownloadResponse) ContentRange() string

ContentRange returns the value for header Content-Range.

func (DownloadResponse) ContentType Uses

func (r DownloadResponse) ContentType() string

ContentType returns the value for header Content-Type.

func (DownloadResponse) CopyCompletionTime Uses

func (r DownloadResponse) CopyCompletionTime() time.Time

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

func (DownloadResponse) CopyID Uses

func (r DownloadResponse) CopyID() string

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

func (DownloadResponse) CopyProgress Uses

func (r DownloadResponse) CopyProgress() string

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

func (DownloadResponse) CopySource Uses

func (r DownloadResponse) CopySource() string

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

func (DownloadResponse) CopyStatus Uses

func (r DownloadResponse) CopyStatus() CopyStatusType

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

func (DownloadResponse) CopyStatusDescription Uses

func (r DownloadResponse) CopyStatusDescription() string

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

func (DownloadResponse) Date Uses

func (r DownloadResponse) Date() time.Time

Date returns the value for header Date.

func (DownloadResponse) ETag Uses

func (r DownloadResponse) ETag() ETag

ETag returns the value for header ETag.

func (DownloadResponse) IsServerEncrypted Uses

func (r DownloadResponse) IsServerEncrypted() string

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

func (DownloadResponse) LastModified Uses

func (r DownloadResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (DownloadResponse) LeaseDuration Uses

func (r DownloadResponse) LeaseDuration() LeaseDurationType

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

func (DownloadResponse) LeaseState Uses

func (r DownloadResponse) LeaseState() LeaseStateType

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

func (DownloadResponse) LeaseStatus Uses

func (r DownloadResponse) LeaseStatus() LeaseStatusType

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

func (DownloadResponse) NewHTTPHeaders Uses

func (r DownloadResponse) NewHTTPHeaders() BlobHTTPHeaders

NewHTTPHeaders returns the user-modifiable properties for this blob.

func (DownloadResponse) NewMetadata Uses

func (r DownloadResponse) NewMetadata() Metadata

NewMetadata returns user-defined key/value pairs.

func (DownloadResponse) RequestID Uses

func (r DownloadResponse) RequestID() string

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

func (DownloadResponse) Response Uses

func (r DownloadResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (DownloadResponse) Status Uses

func (r DownloadResponse) Status() string

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

func (DownloadResponse) StatusCode Uses

func (r DownloadResponse) StatusCode() int

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

func (DownloadResponse) Version Uses

func (r DownloadResponse) Version() string

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

type ETag Uses

type ETag string

ETag is an entity tag.

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

    // ETagAny matches any entity tag.
    ETagAny ETag = "*"
)

type FailedReadNotifier Uses

type FailedReadNotifier func(failureCount int, lastError error, offset int64, count int64, willRetry bool)

FailedReadNotifier is a function type that represents the notification function called when a read fails

type GeoReplication Uses

type GeoReplication struct {
    // Status - The status of the secondary location. Possible values include: 'GeoReplicationStatusLive', 'GeoReplicationStatusBootstrap', 'GeoReplicationStatusUnavailable', 'GeoReplicationStatusNone'
    Status GeoReplicationStatusType `xml:"Status"`
    // LastSyncTime - A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads.
    LastSyncTime time.Time `xml:"LastSyncTime"`
}

GeoReplication - Geo-Replication information for the Secondary Storage Service

func (GeoReplication) MarshalXML Uses

func (gr GeoReplication) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for GeoReplication.

func (*GeoReplication) UnmarshalXML Uses

func (gr *GeoReplication) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements the xml.Unmarshaler interface for GeoReplication.

type GeoReplicationStatusType Uses

type GeoReplicationStatusType string

GeoReplicationStatusType enumerates the values for geo replication status type.

const (
    // GeoReplicationStatusBootstrap ...
    GeoReplicationStatusBootstrap GeoReplicationStatusType = "bootstrap"
    // GeoReplicationStatusLive ...
    GeoReplicationStatusLive GeoReplicationStatusType = "live"
    // GeoReplicationStatusNone represents an empty GeoReplicationStatusType.
    GeoReplicationStatusNone GeoReplicationStatusType = ""
    // GeoReplicationStatusUnavailable ...
    GeoReplicationStatusUnavailable GeoReplicationStatusType = "unavailable"
)

func PossibleGeoReplicationStatusTypeValues Uses

func PossibleGeoReplicationStatusTypeValues() []GeoReplicationStatusType

PossibleGeoReplicationStatusTypeValues returns an array of possible values for the GeoReplicationStatusType const type.

type HTTPGetter Uses

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

HTTPGetter is a function type that refers to a method that performs an HTTP GET operation.

type HTTPGetterInfo Uses

type HTTPGetterInfo struct {
    // Offset specifies the start offset that should be used when
    // creating the HTTP GET request's Range header
    Offset int64

    // Count specifies the count of bytes that should be used to calculate
    // the end offset when creating the HTTP GET request's Range header
    Count int64

    // ETag specifies the resource's etag that should be used when creating
    // the HTTP GET request's If-Match header
    ETag ETag
}

HTTPGetterInfo is passed to an HTTPGetter function passing it parameters that should be used to make an HTTP GET request.

type IPEndpointStyleInfo Uses

type IPEndpointStyleInfo struct {
    AccountName string // "" if not using IP endpoint style
}

IPEndpointStyleInfo is used for IP endpoint style URL when working with Azure storage emulator. Ex: "https://10.132.141.33/accountname/containername"

type IPRange Uses

type IPRange struct {
    Start net.IP // Not specified if length = 0
    End   net.IP // Not specified if length = 0
}

IPRange represents a SAS IP range's start IP and (optionally) end IP.

func (*IPRange) String Uses

func (ipr *IPRange) String() string

String returns a string representation of an IPRange.

type KeyInfo Uses

type KeyInfo struct {
    // Start - The date-time the key is active in ISO 8601 UTC time
    Start string `xml:"Start"`
    // Expiry - The date-time the key expires in ISO 8601 UTC time
    Expiry string `xml:"Expiry"`
}

KeyInfo - Key information

func NewKeyInfo Uses

func NewKeyInfo(Start, Expiry time.Time) KeyInfo

NewKeyInfo creates a new KeyInfo struct with the correct time formatting & conversion

type LeaseAccessConditions Uses

type LeaseAccessConditions struct {
    LeaseID string
}

LeaseAccessConditions identifies lease access conditions for a container or blob which you optionally set.

type LeaseDurationType Uses

type LeaseDurationType string

LeaseDurationType enumerates the values for lease duration type.

const (
    // LeaseDurationFixed ...
    LeaseDurationFixed LeaseDurationType = "fixed"
    // LeaseDurationInfinite ...
    LeaseDurationInfinite LeaseDurationType = "infinite"
    // LeaseDurationNone represents an empty LeaseDurationType.
    LeaseDurationNone LeaseDurationType = ""
)

func PossibleLeaseDurationTypeValues Uses

func PossibleLeaseDurationTypeValues() []LeaseDurationType

PossibleLeaseDurationTypeValues returns an array of possible values for the LeaseDurationType const type.

type LeaseStateType Uses

type LeaseStateType string

LeaseStateType enumerates the values for lease state type.

const (
    // LeaseStateAvailable ...
    LeaseStateAvailable LeaseStateType = "available"
    // LeaseStateBreaking ...
    LeaseStateBreaking LeaseStateType = "breaking"
    // LeaseStateBroken ...
    LeaseStateBroken LeaseStateType = "broken"
    // LeaseStateExpired ...
    LeaseStateExpired LeaseStateType = "expired"
    // LeaseStateLeased ...
    LeaseStateLeased LeaseStateType = "leased"
    // LeaseStateNone represents an empty LeaseStateType.
    LeaseStateNone LeaseStateType = ""
)

func PossibleLeaseStateTypeValues Uses

func PossibleLeaseStateTypeValues() []LeaseStateType

PossibleLeaseStateTypeValues returns an array of possible values for the LeaseStateType const type.

type LeaseStatusType Uses

type LeaseStatusType string

LeaseStatusType enumerates the values for lease status type.

const (
    // LeaseStatusLocked ...
    LeaseStatusLocked LeaseStatusType = "locked"
    // LeaseStatusNone represents an empty LeaseStatusType.
    LeaseStatusNone LeaseStatusType = ""
    // LeaseStatusUnlocked ...
    LeaseStatusUnlocked LeaseStatusType = "unlocked"
)

func PossibleLeaseStatusTypeValues Uses

func PossibleLeaseStatusTypeValues() []LeaseStatusType

PossibleLeaseStatusTypeValues returns an array of possible values for the LeaseStatusType const type.

type ListBlobsFlatSegmentResponse Uses

type ListBlobsFlatSegmentResponse struct {

    // XMLName is used for marshalling and is subject to removal in a future release.
    XMLName         xml.Name            `xml:"EnumerationResults"`
    ServiceEndpoint string              `xml:"ServiceEndpoint,attr"`
    ContainerName   string              `xml:"ContainerName,attr"`
    Prefix          *string             `xml:"Prefix"`
    Marker          *string             `xml:"Marker"`
    MaxResults      *int32              `xml:"MaxResults"`
    Delimiter       *string             `xml:"Delimiter"`
    Segment         BlobFlatListSegment `xml:"Blobs"`
    NextMarker      Marker              `xml:"NextMarker"`
    // contains filtered or unexported fields
}

ListBlobsFlatSegmentResponse - An enumeration of blobs

func (ListBlobsFlatSegmentResponse) ContentType Uses

func (lbfsr ListBlobsFlatSegmentResponse) ContentType() string

ContentType returns the value for header Content-Type.

func (ListBlobsFlatSegmentResponse) Date Uses

func (lbfsr ListBlobsFlatSegmentResponse) Date() time.Time

Date returns the value for header Date.

func (ListBlobsFlatSegmentResponse) ErrorCode Uses

func (lbfsr ListBlobsFlatSegmentResponse) ErrorCode() string

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

func (ListBlobsFlatSegmentResponse) RequestID Uses

func (lbfsr ListBlobsFlatSegmentResponse) RequestID() string

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

func (ListBlobsFlatSegmentResponse) Response Uses

func (lbfsr ListBlobsFlatSegmentResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ListBlobsFlatSegmentResponse) Status Uses

func (lbfsr ListBlobsFlatSegmentResponse) Status() string

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

func (ListBlobsFlatSegmentResponse) StatusCode Uses

func (lbfsr ListBlobsFlatSegmentResponse) StatusCode() int

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

func (ListBlobsFlatSegmentResponse) Version Uses

func (lbfsr ListBlobsFlatSegmentResponse) Version() string

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

type ListBlobsHierarchySegmentResponse Uses

type ListBlobsHierarchySegmentResponse struct {

    // XMLName is used for marshalling and is subject to removal in a future release.
    XMLName         xml.Name                 `xml:"EnumerationResults"`
    ServiceEndpoint string                   `xml:"ServiceEndpoint,attr"`
    ContainerName   string                   `xml:"ContainerName,attr"`
    Prefix          *string                  `xml:"Prefix"`
    Marker          *string                  `xml:"Marker"`
    MaxResults      *int32                   `xml:"MaxResults"`
    Delimiter       *string                  `xml:"Delimiter"`
    Segment         BlobHierarchyListSegment `xml:"Blobs"`
    NextMarker      Marker                   `xml:"NextMarker"`
    // contains filtered or unexported fields
}

ListBlobsHierarchySegmentResponse - An enumeration of blobs

func (ListBlobsHierarchySegmentResponse) ContentType Uses

func (lbhsr ListBlobsHierarchySegmentResponse) ContentType() string

ContentType returns the value for header Content-Type.

func (ListBlobsHierarchySegmentResponse) Date Uses

func (lbhsr ListBlobsHierarchySegmentResponse) Date() time.Time

Date returns the value for header Date.

func (ListBlobsHierarchySegmentResponse) ErrorCode Uses

func (lbhsr ListBlobsHierarchySegmentResponse) ErrorCode() string

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

func (ListBlobsHierarchySegmentResponse) RequestID Uses

func (lbhsr ListBlobsHierarchySegmentResponse) RequestID() string

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

func (ListBlobsHierarchySegmentResponse) Response Uses

func (lbhsr ListBlobsHierarchySegmentResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ListBlobsHierarchySegmentResponse) Status Uses

func (lbhsr ListBlobsHierarchySegmentResponse) Status() string

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

func (ListBlobsHierarchySegmentResponse) StatusCode Uses

func (lbhsr ListBlobsHierarchySegmentResponse) StatusCode() int

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

func (ListBlobsHierarchySegmentResponse) Version Uses

func (lbhsr ListBlobsHierarchySegmentResponse) Version() string

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

type ListBlobsIncludeItemType Uses

type ListBlobsIncludeItemType string

ListBlobsIncludeItemType enumerates the values for list blobs include item type.

const (
    // ListBlobsIncludeItemCopy ...
    ListBlobsIncludeItemCopy ListBlobsIncludeItemType = "copy"
    // ListBlobsIncludeItemDeleted ...
    ListBlobsIncludeItemDeleted ListBlobsIncludeItemType = "deleted"
    // ListBlobsIncludeItemMetadata ...
    ListBlobsIncludeItemMetadata ListBlobsIncludeItemType = "metadata"
    // ListBlobsIncludeItemNone represents an empty ListBlobsIncludeItemType.
    ListBlobsIncludeItemNone ListBlobsIncludeItemType = ""
    // ListBlobsIncludeItemSnapshots ...
    ListBlobsIncludeItemSnapshots ListBlobsIncludeItemType = "snapshots"
    // ListBlobsIncludeItemUncommittedblobs ...
    ListBlobsIncludeItemUncommittedblobs ListBlobsIncludeItemType = "uncommittedblobs"
)

func PossibleListBlobsIncludeItemTypeValues Uses

func PossibleListBlobsIncludeItemTypeValues() []ListBlobsIncludeItemType

PossibleListBlobsIncludeItemTypeValues returns an array of possible values for the ListBlobsIncludeItemType const type.

type ListBlobsSegmentOptions Uses

type ListBlobsSegmentOptions struct {
    Details BlobListingDetails // No IncludeType header is produced if ""
    Prefix  string             // No Prefix header is produced if ""

    // SetMaxResults sets the maximum desired results you want the service to return. Note, the
    // service may return fewer results than requested.
    // MaxResults=0 means no 'MaxResults' header specified.
    MaxResults int32
}

ListBlobsSegmentOptions defines options available when calling ListBlobs.

type ListContainersDetail Uses

type ListContainersDetail struct {
    // Tells the service whether to return metadata for each container.
    Metadata bool
}

ListContainersFlatDetail indicates what additional information the service should return with each container.

type ListContainersIncludeType Uses

type ListContainersIncludeType string

ListContainersIncludeType enumerates the values for list containers include type.

const (
    // ListContainersIncludeMetadata ...
    ListContainersIncludeMetadata ListContainersIncludeType = "metadata"
    // ListContainersIncludeNone represents an empty ListContainersIncludeType.
    ListContainersIncludeNone ListContainersIncludeType = ""
)

func PossibleListContainersIncludeTypeValues Uses

func PossibleListContainersIncludeTypeValues() []ListContainersIncludeType

PossibleListContainersIncludeTypeValues returns an array of possible values for the ListContainersIncludeType const type.

type ListContainersSegmentOptions Uses

type ListContainersSegmentOptions struct {
    Detail     ListContainersDetail // No IncludeType header is produced if ""
    Prefix     string               // No Prefix header is produced if ""
    MaxResults int32                // 0 means unspecified

}

ListContainersOptions defines options available when calling ListContainers.

type ListContainersSegmentResponse Uses

type ListContainersSegmentResponse struct {

    // XMLName is used for marshalling and is subject to removal in a future release.
    XMLName         xml.Name        `xml:"EnumerationResults"`
    ServiceEndpoint string          `xml:"ServiceEndpoint,attr"`
    Prefix          *string         `xml:"Prefix"`
    Marker          *string         `xml:"Marker"`
    MaxResults      *int32          `xml:"MaxResults"`
    ContainerItems  []ContainerItem `xml:"Containers>Container"`
    NextMarker      Marker          `xml:"NextMarker"`
    // contains filtered or unexported fields
}

ListContainersSegmentResponse - An enumeration of containers

func (ListContainersSegmentResponse) ErrorCode Uses

func (lcsr ListContainersSegmentResponse) ErrorCode() string

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

func (ListContainersSegmentResponse) RequestID Uses

func (lcsr ListContainersSegmentResponse) RequestID() string

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

func (ListContainersSegmentResponse) Response Uses

func (lcsr ListContainersSegmentResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (ListContainersSegmentResponse) Status Uses

func (lcsr ListContainersSegmentResponse) Status() string

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

func (ListContainersSegmentResponse) StatusCode Uses

func (lcsr ListContainersSegmentResponse) StatusCode() int

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

func (ListContainersSegmentResponse) Version Uses

func (lcsr ListContainersSegmentResponse) Version() string

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

type Logging Uses

type Logging struct {
    // Version - The version of Storage Analytics to configure.
    Version string `xml:"Version"`
    // Delete - Indicates whether all delete requests should be logged.
    Delete bool `xml:"Delete"`
    // Read - Indicates whether all read requests should be logged.
    Read bool `xml:"Read"`
    // Write - Indicates whether all write requests should be logged.
    Write           bool            `xml:"Write"`
    RetentionPolicy RetentionPolicy `xml:"RetentionPolicy"`
}

Logging - Azure Analytics Logging settings.

type Marker Uses

type Marker struct {
    Val *string
}

Marker represents an opaque value used in paged responses.

func (Marker) NotDone Uses

func (m Marker) NotDone() bool

NotDone returns true if the list enumeration should be started or is not yet complete. Specifically, NotDone returns true for a just-initialized (zero value) Marker indicating that you should make an initial request to get a result portion from the service. NotDone also returns true whenever the service returns an interim result portion. NotDone returns false only after the service has returned the final result portion.

func (*Marker) UnmarshalXML Uses

func (m *Marker) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements the xml.Unmarshaler interface for Marker.

type Metadata Uses

type Metadata map[string]string

Metadata contains metadata key/value pairs.

This examples shows how to create a blob with metadata and then how to read & update the blob's read-only properties and metadata.

Code:

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

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

// Create a blob with metadata (string key/value pairs)
// NOTE: Metadata key names are always converted to lowercase before being sent to the Storage Service.
// Therefore, you should always use lowercase letters; especially when querying a map for a metadata key.
creatingApp, _ := os.Executable()
_, err = blobURL.Upload(ctx, strings.NewReader("Some text"), azblob.BlobHTTPHeaders{},
    azblob.Metadata{"author": "Jeffrey", "app": creatingApp}, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}

// Query the blob's properties and metadata
get, err := blobURL.GetProperties(ctx, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}

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

// Show the blob's metadata
metadata := get.NewMetadata()
for k, v := range metadata {
    fmt.Print(k + "=" + v + "\n")
}

// Update the blob's metadata and write it back to the blob
metadata["editor"] = "Grant" // Add a new key/value; NOTE: The keyname is in all lowercase letters
_, err = blobURL.SetMetadata(ctx, metadata, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}

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

This examples shows how to create a container with metadata and then how to read & update the metadata.

Code:

// 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 container's URL and a default pipeline.
u, _ := url.Parse(fmt.Sprintf("https://%s.blob.core.windows.net/mycontainer", accountName))
credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
if err != nil {
    log.Fatal(err)
}
containerURL := azblob.NewContainerURL(*u, azblob.NewPipeline(credential, azblob.PipelineOptions{}))

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

// Create a container with some metadata (string key/value pairs)
// NOTE: Metadata key names are always converted to lowercase before being sent to the Storage Service.
// Therefore, you should always use lowercase letters; especially when querying a map for a metadata key.
creatingApp, _ := os.Executable()
_, err = containerURL.Create(ctx, azblob.Metadata{"author": "Jeffrey", "app": creatingApp}, azblob.PublicAccessNone)
if err != nil {
    log.Fatal(err)
}

// Query the container's metadata
get, err := containerURL.GetProperties(ctx, azblob.LeaseAccessConditions{})
if err != nil {
    log.Fatal(err)
}

// Show the container's metadata
metadata := get.NewMetadata()
for k, v := range metadata {
    fmt.Print(k + "=" + v + "\n")
}

// Update the metadata and write it back to the container
metadata["author"] = "Aidan" // NOTE: The keyname is in all lowercase letters
_, err = containerURL.SetMetadata(ctx, metadata, azblob.ContainerAccessConditions{})
if err != nil {
    log.Fatal(err)
}

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

func (*Metadata) UnmarshalXML Uses

func (md *Metadata) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements the xml.Unmarshaler interface for Metadata.

type Metrics Uses

type Metrics struct {
    // Version - The version of Storage Analytics to configure.
    Version *string `xml:"Version"`
    // Enabled - Indicates whether metrics are enabled for the Blob service.
    Enabled bool `xml:"Enabled"`
    // IncludeAPIs - Indicates whether metrics should generate summary statistics for called API operations.
    IncludeAPIs     *bool            `xml:"IncludeAPIs"`
    RetentionPolicy *RetentionPolicy `xml:"RetentionPolicy"`
}

Metrics - a summary of request statistics grouped by API in hour or minute aggregates for blobs

type ModifiedAccessConditions Uses

type ModifiedAccessConditions struct {
    IfModifiedSince   time.Time
    IfUnmodifiedSince time.Time
    IfMatch           ETag
    IfNoneMatch       ETag
}

ModifiedAccessConditions identifies standard HTTP access conditions which you optionally set.

type PageBlobAccessConditions Uses

type PageBlobAccessConditions struct {
    ModifiedAccessConditions
    LeaseAccessConditions
    SequenceNumberAccessConditions
}

type PageBlobClearPagesResponse Uses

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

PageBlobClearPagesResponse ...

func (PageBlobClearPagesResponse) BlobSequenceNumber Uses

func (pbcpr PageBlobClearPagesResponse) BlobSequenceNumber() int64

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

func (PageBlobClearPagesResponse) ContentMD5 Uses

func (pbcpr PageBlobClearPagesResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (PageBlobClearPagesResponse) Date Uses

func (pbcpr PageBlobClearPagesResponse) Date() time.Time

Date returns the value for header Date.

func (PageBlobClearPagesResponse) ETag Uses

func (pbcpr PageBlobClearPagesResponse) ETag() ETag

ETag returns the value for header ETag.

func (PageBlobClearPagesResponse) ErrorCode Uses

func (pbcpr PageBlobClearPagesResponse) ErrorCode() string

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

func (PageBlobClearPagesResponse) LastModified Uses

func (pbcpr PageBlobClearPagesResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (PageBlobClearPagesResponse) RequestID Uses

func (pbcpr PageBlobClearPagesResponse) RequestID() string

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

func (PageBlobClearPagesResponse) Response Uses

func (pbcpr PageBlobClearPagesResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (PageBlobClearPagesResponse) Status Uses

func (pbcpr PageBlobClearPagesResponse) Status() string

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

func (PageBlobClearPagesResponse) StatusCode Uses

func (pbcpr PageBlobClearPagesResponse) StatusCode() int

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

func (PageBlobClearPagesResponse) Version Uses

func (pbcpr PageBlobClearPagesResponse) Version() string

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

type PageBlobCopyIncrementalResponse Uses

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

PageBlobCopyIncrementalResponse ...

func (PageBlobCopyIncrementalResponse) CopyID Uses

func (pbcir PageBlobCopyIncrementalResponse) CopyID() string

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

func (PageBlobCopyIncrementalResponse) CopyStatus Uses

func (pbcir PageBlobCopyIncrementalResponse) CopyStatus() CopyStatusType

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

func (PageBlobCopyIncrementalResponse) Date Uses

func (pbcir PageBlobCopyIncrementalResponse) Date() time.Time

Date returns the value for header Date.

func (PageBlobCopyIncrementalResponse) ETag Uses

func (pbcir PageBlobCopyIncrementalResponse) ETag() ETag

ETag returns the value for header ETag.

func (PageBlobCopyIncrementalResponse) ErrorCode Uses

func (pbcir PageBlobCopyIncrementalResponse) ErrorCode() string

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

func (PageBlobCopyIncrementalResponse) LastModified Uses

func (pbcir PageBlobCopyIncrementalResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (PageBlobCopyIncrementalResponse) RequestID Uses

func (pbcir PageBlobCopyIncrementalResponse) RequestID() string

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

func (PageBlobCopyIncrementalResponse) Response Uses

func (pbcir PageBlobCopyIncrementalResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (PageBlobCopyIncrementalResponse) Status Uses

func (pbcir PageBlobCopyIncrementalResponse) Status() string

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

func (PageBlobCopyIncrementalResponse) StatusCode Uses

func (pbcir PageBlobCopyIncrementalResponse) StatusCode() int

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

func (PageBlobCopyIncrementalResponse) Version Uses

func (pbcir PageBlobCopyIncrementalResponse) Version() string

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

type PageBlobCreateResponse Uses

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

PageBlobCreateResponse ...

func (PageBlobCreateResponse) ContentMD5 Uses

func (pbcr PageBlobCreateResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (PageBlobCreateResponse) Date Uses

func (pbcr PageBlobCreateResponse) Date() time.Time

Date returns the value for header Date.

func (PageBlobCreateResponse) ETag Uses

func (pbcr PageBlobCreateResponse) ETag() ETag

ETag returns the value for header ETag.

func (PageBlobCreateResponse) ErrorCode Uses

func (pbcr PageBlobCreateResponse) ErrorCode() string

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

func (PageBlobCreateResponse) IsServerEncrypted Uses

func (pbcr PageBlobCreateResponse) IsServerEncrypted() string

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

func (PageBlobCreateResponse) LastModified Uses

func (pbcr PageBlobCreateResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (PageBlobCreateResponse) RequestID Uses

func (pbcr PageBlobCreateResponse) RequestID() string

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

func (PageBlobCreateResponse) Response Uses

func (pbcr PageBlobCreateResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (PageBlobCreateResponse) Status Uses

func (pbcr PageBlobCreateResponse) Status() string

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

func (PageBlobCreateResponse) StatusCode Uses

func (pbcr PageBlobCreateResponse) StatusCode() int

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

func (PageBlobCreateResponse) Version Uses

func (pbcr PageBlobCreateResponse) Version() string

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

type PageBlobResizeResponse Uses

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

PageBlobResizeResponse ...

func (PageBlobResizeResponse) BlobSequenceNumber Uses

func (pbrr PageBlobResizeResponse) BlobSequenceNumber() int64

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

func (PageBlobResizeResponse) Date Uses

func (pbrr PageBlobResizeResponse) Date() time.Time

Date returns the value for header Date.

func (PageBlobResizeResponse) ETag Uses

func (pbrr PageBlobResizeResponse) ETag() ETag

ETag returns the value for header ETag.

func (PageBlobResizeResponse) ErrorCode Uses

func (pbrr PageBlobResizeResponse) ErrorCode() string

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

func (PageBlobResizeResponse) LastModified Uses

func (pbrr PageBlobResizeResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (PageBlobResizeResponse) RequestID Uses

func (pbrr PageBlobResizeResponse) RequestID() string

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

func (PageBlobResizeResponse) Response Uses

func (pbrr PageBlobResizeResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (PageBlobResizeResponse) Status Uses

func (pbrr PageBlobResizeResponse) Status() string

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

func (PageBlobResizeResponse) StatusCode Uses

func (pbrr PageBlobResizeResponse) StatusCode() int

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

func (PageBlobResizeResponse) Version Uses

func (pbrr PageBlobResizeResponse) Version() string

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

type PageBlobURL Uses

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

PageBlobURL defines a set of operations applicable to page blobs.

ExamplePageBlobURL shows how to manipulate a page blob with PageBlobURL. A page blob is a collection of 512-byte pages optimized for random read and write operations. The maximum size for a page blob is 8 TB.

Code:

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

// Create a 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/MyPageBlob.txt", accountName))
credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
if err != nil {
    log.Fatal(err)
}
blobURL := azblob.NewPageBlobURL(*u, azblob.NewPipeline(credential, azblob.PipelineOptions{}))

ctx := context.Background() // This example uses a never-expiring context
_, err = blobURL.Create(ctx, azblob.PageBlobPageBytes*4, 0, azblob.BlobHTTPHeaders{},
    azblob.Metadata{}, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}

page := [azblob.PageBlobPageBytes]byte{}
copy(page[:], "Page 0")
_, err = blobURL.UploadPages(ctx, 0*azblob.PageBlobPageBytes, bytes.NewReader(page[:]), azblob.PageBlobAccessConditions{}, nil)
if err != nil {
    log.Fatal(err)
}

copy(page[:], "Page 1")
_, err = blobURL.UploadPages(ctx, 2*azblob.PageBlobPageBytes, bytes.NewReader(page[:]), azblob.PageBlobAccessConditions{}, nil)
if err != nil {
    log.Fatal(err)
}

getPages, err := blobURL.GetPageRanges(ctx, 0*azblob.PageBlobPageBytes, 10*azblob.PageBlobPageBytes, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}
for _, pr := range getPages.PageRange {
    fmt.Printf("Start=%d, End=%d\n", pr.Start, pr.End)
}

_, err = blobURL.ClearPages(ctx, 0*azblob.PageBlobPageBytes, 1*azblob.PageBlobPageBytes, azblob.PageBlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}

getPages, err = blobURL.GetPageRanges(ctx, 0*azblob.PageBlobPageBytes, 10*azblob.PageBlobPageBytes, azblob.BlobAccessConditions{})
if err != nil {
    log.Fatal(err)
}
for _, pr := range getPages.PageRange {
    fmt.Printf("Start=%d, End=%d\n", pr.Start, pr.End)
}

get, err := blobURL.Download(ctx, 0, 0, azblob.BlobAccessConditions{}, false)
if err != nil {
    log.Fatal(err)
}
blobData := &bytes.Buffer{}
reader := get.Body(azblob.RetryReaderOptions{})
blobData.ReadFrom(reader)
reader.Close() // The client must close the response body when finished with it
fmt.Printf("%#v", blobData.Bytes())

func NewPageBlobURL Uses

func NewPageBlobURL(url url.URL, p pipeline.Pipeline) PageBlobURL

NewPageBlobURL creates a PageBlobURL object using the specified URL and request policy pipeline.

func (PageBlobURL) ClearPages Uses

func (pb PageBlobURL) ClearPages(ctx context.Context, offset int64, count int64, ac PageBlobAccessConditions) (*PageBlobClearPagesResponse, error)

ClearPages frees the specified pages from the page blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-page.

func (PageBlobURL) Create Uses

func (pb PageBlobURL) Create(ctx context.Context, size int64, sequenceNumber int64, h BlobHTTPHeaders, metadata Metadata, ac BlobAccessConditions) (*PageBlobCreateResponse, error)

Create creates a page blob of the specified length. Call PutPage to upload data data to a page blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-blob.

func (PageBlobURL) GetPageRanges Uses

func (pb PageBlobURL) GetPageRanges(ctx context.Context, offset int64, count int64, ac BlobAccessConditions) (*PageList, error)

GetPageRanges returns the list of valid page ranges for a page blob or snapshot of a page blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges.

func (PageBlobURL) GetPageRangesDiff Uses

func (pb PageBlobURL) GetPageRangesDiff(ctx context.Context, offset int64, count int64, prevSnapshot string, ac BlobAccessConditions) (*PageList, error)

GetPageRangesDiff gets the collection of page ranges that differ between a specified snapshot and this page blob. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges.

func (PageBlobURL) Resize Uses

func (pb PageBlobURL) Resize(ctx context.Context, size int64, ac BlobAccessConditions) (*PageBlobResizeResponse, error)

Resize resizes the page blob to the specified size (which must be a multiple of 512). For more information, see https://docs.microsoft.com/rest/api/storageservices/set-blob-properties.

func (PageBlobURL) StartCopyIncremental Uses

func (pb PageBlobURL) StartCopyIncremental(ctx context.Context, source url.URL, snapshot string, ac BlobAccessConditions) (*PageBlobCopyIncrementalResponse, error)

StartIncrementalCopy begins an operation to start an incremental copy from one page blob's snapshot to this page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. For more information, see https://docs.microsoft.com/rest/api/storageservices/incremental-copy-blob and https://docs.microsoft.com/en-us/azure/virtual-machines/windows/incremental-snapshots.

func (PageBlobURL) UpdateSequenceNumber Uses

func (pb PageBlobURL) UpdateSequenceNumber(ctx context.Context, action SequenceNumberActionType, sequenceNumber int64,
    ac BlobAccessConditions) (*PageBlobUpdateSequenceNumberResponse, error)

SetSequenceNumber sets the page blob's sequence number.

func (PageBlobURL) UploadPages Uses

func (pb PageBlobURL) UploadPages(ctx context.Context, offset int64, body io.ReadSeeker, ac PageBlobAccessConditions, transactionalMD5 []byte) (*PageBlobUploadPagesResponse, error)

UploadPages writes 1 or more pages to the page blob. The start offset and the stream size must be a multiple of 512 bytes. This method panics if the stream is not at position 0. Note that the http client closes the body stream after the request is sent to the service. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-page.

func (PageBlobURL) UploadPagesFromURL Uses

func (pb PageBlobURL) UploadPagesFromURL(ctx context.Context, sourceURL url.URL, sourceOffset int64, destOffset int64, count int64, transactionalMD5 []byte, destinationAccessConditions PageBlobAccessConditions, sourceAccessConditions ModifiedAccessConditions) (*PageBlobUploadPagesFromURLResponse, error)

UploadPagesFromURL copies 1 or more pages from a source URL to the page blob. The sourceOffset specifies the start offset of source data to copy from. The destOffset specifies the start offset of data in page blob will be written to. The count must be a multiple of 512 bytes. For more information, see https://docs.microsoft.com/rest/api/storageservices/put-page-from-url.

func (PageBlobURL) WithPipeline Uses

func (pb PageBlobURL) WithPipeline(p pipeline.Pipeline) PageBlobURL

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

func (PageBlobURL) WithSnapshot Uses

func (pb PageBlobURL) WithSnapshot(snapshot string) PageBlobURL

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

type PageBlobUpdateSequenceNumberResponse Uses

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

PageBlobUpdateSequenceNumberResponse ...

func (PageBlobUpdateSequenceNumberResponse) BlobSequenceNumber Uses

func (pbusnr PageBlobUpdateSequenceNumberResponse) BlobSequenceNumber() int64

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

func (PageBlobUpdateSequenceNumberResponse) Date Uses

func (pbusnr PageBlobUpdateSequenceNumberResponse) Date() time.Time

Date returns the value for header Date.

func (PageBlobUpdateSequenceNumberResponse) ETag Uses

func (pbusnr PageBlobUpdateSequenceNumberResponse) ETag() ETag

ETag returns the value for header ETag.

func (PageBlobUpdateSequenceNumberResponse) ErrorCode Uses

func (pbusnr PageBlobUpdateSequenceNumberResponse) ErrorCode() string

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

func (PageBlobUpdateSequenceNumberResponse) LastModified Uses

func (pbusnr PageBlobUpdateSequenceNumberResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (PageBlobUpdateSequenceNumberResponse) RequestID Uses

func (pbusnr PageBlobUpdateSequenceNumberResponse) RequestID() string

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

func (PageBlobUpdateSequenceNumberResponse) Response Uses

func (pbusnr PageBlobUpdateSequenceNumberResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (PageBlobUpdateSequenceNumberResponse) Status Uses

func (pbusnr PageBlobUpdateSequenceNumberResponse) Status() string

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

func (PageBlobUpdateSequenceNumberResponse) StatusCode Uses

func (pbusnr PageBlobUpdateSequenceNumberResponse) StatusCode() int

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

func (PageBlobUpdateSequenceNumberResponse) Version Uses

func (pbusnr PageBlobUpdateSequenceNumberResponse) Version() string

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

type PageBlobUploadPagesFromURLResponse Uses

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

PageBlobUploadPagesFromURLResponse ...

func (PageBlobUploadPagesFromURLResponse) BlobSequenceNumber Uses

func (pbupfur PageBlobUploadPagesFromURLResponse) BlobSequenceNumber() int64

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

func (PageBlobUploadPagesFromURLResponse) ContentMD5 Uses

func (pbupfur PageBlobUploadPagesFromURLResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (PageBlobUploadPagesFromURLResponse) Date Uses

func (pbupfur PageBlobUploadPagesFromURLResponse) Date() time.Time

Date returns the value for header Date.

func (PageBlobUploadPagesFromURLResponse) ETag Uses

func (pbupfur PageBlobUploadPagesFromURLResponse) ETag() ETag

ETag returns the value for header ETag.

func (PageBlobUploadPagesFromURLResponse) ErrorCode Uses

func (pbupfur PageBlobUploadPagesFromURLResponse) ErrorCode() string

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

func (PageBlobUploadPagesFromURLResponse) IsServerEncrypted Uses

func (pbupfur PageBlobUploadPagesFromURLResponse) IsServerEncrypted() string

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

func (PageBlobUploadPagesFromURLResponse) LastModified Uses

func (pbupfur PageBlobUploadPagesFromURLResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (PageBlobUploadPagesFromURLResponse) RequestID Uses

func (pbupfur PageBlobUploadPagesFromURLResponse) RequestID() string

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

func (PageBlobUploadPagesFromURLResponse) Response Uses

func (pbupfur PageBlobUploadPagesFromURLResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (PageBlobUploadPagesFromURLResponse) Status Uses

func (pbupfur PageBlobUploadPagesFromURLResponse) Status() string

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

func (PageBlobUploadPagesFromURLResponse) StatusCode Uses

func (pbupfur PageBlobUploadPagesFromURLResponse) StatusCode() int

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

func (PageBlobUploadPagesFromURLResponse) Version Uses

func (pbupfur PageBlobUploadPagesFromURLResponse) Version() string

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

type PageBlobUploadPagesResponse Uses

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

PageBlobUploadPagesResponse ...

func (PageBlobUploadPagesResponse) BlobSequenceNumber Uses

func (pbupr PageBlobUploadPagesResponse) BlobSequenceNumber() int64

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

func (PageBlobUploadPagesResponse) ContentMD5 Uses

func (pbupr PageBlobUploadPagesResponse) ContentMD5() []byte

ContentMD5 returns the value for header Content-MD5.

func (PageBlobUploadPagesResponse) Date Uses

func (pbupr PageBlobUploadPagesResponse) Date() time.Time

Date returns the value for header Date.

func (PageBlobUploadPagesResponse) ETag Uses

func (pbupr PageBlobUploadPagesResponse) ETag() ETag

ETag returns the value for header ETag.

func (PageBlobUploadPagesResponse) ErrorCode Uses

func (pbupr PageBlobUploadPagesResponse) ErrorCode() string

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

func (PageBlobUploadPagesResponse) IsServerEncrypted Uses

func (pbupr PageBlobUploadPagesResponse) IsServerEncrypted() string

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

func (PageBlobUploadPagesResponse) LastModified Uses

func (pbupr PageBlobUploadPagesResponse) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (PageBlobUploadPagesResponse) RequestID Uses

func (pbupr PageBlobUploadPagesResponse) RequestID() string

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

func (PageBlobUploadPagesResponse) Response Uses

func (pbupr PageBlobUploadPagesResponse) Response() *http.Response

Response returns the raw HTTP response object.

func (PageBlobUploadPagesResponse) Status Uses

func (pbupr PageBlobUploadPagesResponse) Status() string

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

func (PageBlobUploadPagesResponse) StatusCode Uses

func (pbupr PageBlobUploadPagesResponse) StatusCode() int

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

func (PageBlobUploadPagesResponse) Version Uses

func (pbupr PageBlobUploadPagesResponse) Version() string

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

type PageList Uses

type PageList struct {
    PageRange  []PageRange  `xml:"PageRange"`
    ClearRange []ClearRange `xml:"ClearRange"`
    // contains filtered or unexported fields
}

PageList - the list of pages

func (PageList) BlobContentLength Uses

func (pl PageList) BlobContentLength() int64

BlobContentLength returns the value for header x-ms-blob-content-length.

func (PageList) Date Uses

func (pl PageList) Date() time.Time

Date returns the value for header Date.

func (PageList) ETag Uses

func (pl PageList) ETag() ETag

ETag returns the value for header ETag.

func (PageList) ErrorCode Uses

func (pl PageList) ErrorCode() string

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

func (PageList) LastModified Uses

func (pl PageList) LastModified() time.Time

LastModified returns the value for header Last-Modified.

func (PageList) RequestID Uses

func (pl PageList) RequestID() string

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

func (PageList) Response Uses

func (pl PageList) Response() *http.Response

Response returns the raw HTTP response object.

func (PageList) Status Uses

func (pl PageList) Status() string

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

func (PageList) StatusCode Uses

func (pl PageList) StatusCode() int

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

func (PageList) Version Uses

func (pl PageList) Version() string

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

type PageRange Uses

type PageRange struct {
    Start int64 `xml:"Start"`
    End   int64 `xml:"End"`
}

PageRange ...

type PipelineOptions Uses

type PipelineOptions struct {
    // Log configures the pipeline's logging infrastructure indicating what information is logged and where.
    Log pipeline.LogOptions

    // Retry configures the built-in retry policy behavior.
    Retry RetryOptions

    // RequestLog configures the built-in request logging policy.
    RequestLog RequestLogOptions

    // Telemetry configures the built-in telemetry policy behavior.
    Telemetry TelemetryOptions

    // HTTPSender configures the sender of HTTP requests
    HTTPSender pipeline.Factory
}

PipelineOptions is used to configure a request policy pipeline's retry policy and logging.

type PublicAccessType Uses

type PublicAccessType string

PublicAccessType enumerates the values for public access type.

const (
    // PublicAccessBlob ...
    PublicAccessBlob PublicAccessType = "blob"
    // PublicAccessContainer ...
    PublicAccessContainer PublicAccessType = "container"
    // PublicAccessNone represents an empty PublicAccessType.
    PublicAccessNone PublicAccessType = ""
)

func PossiblePublicAccessTypeValues Uses

func PossiblePublicAccessTypeValues() []PublicAccessType

PossiblePublicAccessTypeValues returns an array of possible values for the PublicAccessType const type.

type RequestLogOptions Uses

type RequestLogOptions struct {
    // LogWarningIfTryOverThreshold logs a warning if a tried operation takes longer than the specified
    // duration (-1=no logging; 0=default threshold).
    LogWarningIfTryOverThreshold time.Duration
}

RequestLogOptions configures the retry policy's behavior.

type ResponseError Uses

type ResponseError interface {
    // Error exposes the Error(), Temporary() and Timeout() methods.
    net.Error // Includes the Go error interface
    // Response returns the HTTP response. You may examine this but you should not modify it.
    Response() *http.Response
}

ResponseError identifies a responder-generated network or response parsing error.

type RetentionPolicy Uses

type RetentionPolicy struct {
    // Enabled - Indicates whether a retention policy is enabled for the storage service
    Enabled bool `xml:"Enabled"`
    // Days - Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted
    Days *int32 `xml:"Days"`
}

RetentionPolicy - the retention policy which determines how long the associated data should persist

type RetryOptions Uses

type RetryOptions struct {
    // Policy tells the pipeline what kind of retry policy to use. See the RetryPolicy* constants.\
    // A value of zero means that you accept our default policy.
    Policy RetryPolicy

    // MaxTries specifies the maximum number of attempts an operation will be tried before producing an error (0=default).
    // A value of zero means that you accept our default policy. A value of 1 means 1 try and no retries.
    MaxTries int32

    // TryTimeout indicates the maximum time allowed for any single try of an HTTP request.
    // A value of zero means that you accept our default timeout. NOTE: When transferring large amounts
    // of data, the default TryTimeout will probably not be sufficient. You should override this value
    // based on the bandwidth available to the host machine and proximity to the Storage service. A good
    // starting point may be something like (60 seconds per MB of anticipated-payload-size).
    TryTimeout time.Duration

    // RetryDelay specifies the amount of delay to use before retrying an operation (0=default).
    // When RetryPolicy is specified as RetryPolicyExponential, the delay increases exponentially
    // with each retry up to a maximum specified by MaxRetryDelay.
    // If you specify 0, then you must also specify 0 for MaxRetryDelay.
    // If you specify RetryDelay, then you must also specify MaxRetryDelay, and MaxRetryDelay should be
    // equal to or greater than RetryDelay.
    RetryDelay time.Duration

    // MaxRetryDelay specifies the maximum delay allowed before retrying an operation (0=default).
    // If you specify 0, then you must also specify 0 for RetryDelay.
    MaxRetryDelay time.Duration

    // RetryReadsFromSecondaryHost specifies whether the retry policy should retry a read operation against another host.
    // If RetryReadsFromSecondaryHost is "" (the default) then operations are not retried against another host.
    // NOTE: Before setting this field, make sure you understand the issues around reading stale & potentially-inconsistent
    // data at this webpage: https://docs.microsoft.com/en-us/azure/storage/common/storage-designing-ha-apps-with-ragrs
    RetryReadsFromSecondaryHost string // Comment this our for non-Blob SDKs
}

RetryOptions configures the retry policy's behavior.

type RetryPolicy Uses

type RetryPolicy int32

RetryPolicy tells the pipeline what kind of retry policy to use. See the RetryPolicy* constants.

const (
    // RetryPolicyExponential tells the pipeline to use an exponential back-off retry policy
    RetryPolicyExponential RetryPolicy = 0

    // RetryPolicyFixed tells the pipeline to use a fixed back-off retry policy
    RetryPolicyFixed RetryPolicy = 1
)

type RetryReaderOptions Uses

type RetryReaderOptions struct {
    // MaxRetryRequests specifies the maximum number of HTTP GET requests that will be made
    // while reading from a RetryReader. A value of zero means that no additional HTTP
    // GET requests will be made.
    MaxRetryRequests int

    // NotifyFailedRead is called, if non-nil, after any failure to read. Expected usage is diagnostic logging.
    NotifyFailedRead FailedReadNotifier

    // TreatEarlyCloseAsError can be set to true to prevent retries after "read on closed response body". By default,
    // retryReader has the following special behaviour: closing the response body before it is all read is treated as a
    // retryable error. This is to allow callers to force a retry by closing the body from another goroutine (e.g. if the =
    // read is too slow, caller may want to force a retry in the hope that the retry will be quicker).  If
    // TreatEarlyCloseAsError is true, then retryReader's special behaviour is suppressed, and "read on closed body" is instead
    // treated as a fatal (non-retryable) error.
    // Note that setting TreatEarlyCloseAsError only guarantees that Closing will produce a fatal error if the Close happens
    // from the same "thread" (goroutine) as Read.  Concurrent Close calls from other goroutines may instead produce network errors
    // which will be retried.
    TreatEarlyCloseAsError bool
    // contains filtered or unexported fields
}

RetryReaderOptions contains properties which can help to decide when to do retry.

type SASProtocol Uses

type SASProtocol string
const (
    // SASProtocolHTTPS can be specified for a SAS protocol
    SASProtocolHTTPS SASProtocol = "https"

    // SASProtocolHTTPSandHTTP can be specified for a SAS protocol
    SASProtocolHTTPSandHTTP SASProtocol = "https,http"
)

type SASQueryParameters Uses

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

A SASQueryParameters object represents the components that make up an Azure Storage SAS' query parameters. You parse a map of query parameters into its fields by calling NewSASQueryParameters(). You add the components to a query parameter map by calling AddToValues(). NOTE: Changing any field requires computing a new SAS signature using a XxxSASSignatureValues type.

This type defines the components used by all Azure Storage resources (Containers, Blobs, Files, & Queues).

func (*SASQueryParameters) CacheControl Uses

func (p *SASQueryParameters) CacheControl() string

func (*SASQueryParameters) ContentDisposition Uses

func (p *SASQueryParameters) ContentDisposition() string

func (*SASQueryParameters) ContentEncoding Uses

func (p *SASQueryParameters) ContentEncoding() string

func (*SASQueryParameters) ContentLanguage Uses

func (p *SASQueryParameters) ContentLanguage() string

func (*SASQueryParameters) ContentType Uses

func (p *SASQueryParameters) ContentType() string

func (*SASQueryParameters) Encode Uses

func (p *SASQueryParameters) Encode() string

Encode encodes the SAS query parameters into URL encoded form sorted by key.

func (*SASQueryParameters) ExpiryTime Uses

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

func (*SASQueryParameters) IPRange Uses

func (p *SASQueryParameters) IPRange() IPRange

func (*SASQueryParameters) Identifier Uses

func (p *SASQueryParameters) Identifier() string

func (*SASQueryParameters) Permissions Uses

func (p *SASQueryParameters) Permissions() string

func (*SASQueryParameters) Protocol Uses

func (p *SASQueryParameters) Protocol() SASProtocol

func (*SASQueryParameters) Resource Uses

func (p *SASQueryParameters) Resource() string

func (*SASQueryParameters) ResourceTypes Uses

func (p *SASQueryParameters) ResourceTypes() string

func (*SASQueryParameters) Services Uses

func (p *SASQueryParameters) Services() string

func (*SASQueryParameters) Signature Uses

func (p *SASQueryParameters) Signature() string

func (*SASQueryParameters) SignedExpiry