GetCanonicalName() private method

Gets the canonical name of the blob, formatted as /<account-name>/<container-name>/<blob-name>. If ignoreSnapshotTime is false and this blob is a snapshot, the canonical name is augmented with a query of the form ?snapshot=<snapshot-time>.

This is used by both Shared Access and Copy blob operations.

Used by both Shared Access and Copy blob operation.
private GetCanonicalName ( bool ignoreSnapshotTime ) : string
ignoreSnapshotTime bool Indicates if the snapshot time is ignored.
return string
Esempio n. 1
0
        /// <summary>
        /// Implementation of the CopyFromBlob method.
        /// </summary>
        /// <param name="source">The source blob.</param>
        /// <param name="options">An object that specifies any additional options for the request.</param>
        /// <returns>A <see cref="TaskSequence"/> that copies the blob.</returns>
        private TaskSequence CopyFromBlobImpl(CloudBlob source, BlobRequestOptions options)
        {
            CommonUtils.AssertNotNull("options", options);

            string sourceBlobUri = source.GetCanonicalName(false);

            ConditionHeaderKind header;
            string value;
            AccessCondition.GetSourceConditions(options.CopySourceAccessCondition, out header, out value);

            var webRequest = ProtocolHelper.GetWebRequest(
                this.ServiceClient,
                options,
                (timeout) => BlobRequest.CopyFrom(this.TransformedAddress, timeout, sourceBlobUri, this.SnapshotTime, header, value, null));

            BlobRequest.AddMetadata(webRequest, this.Metadata);

            this.ServiceClient.Credentials.SignRequest(webRequest);
            var copyTask = webRequest.GetResponseAsyncWithTimeout(this.ServiceClient, options.Timeout);
            yield return copyTask;

            // Parse the response
            using (HttpWebResponse webResponse = copyTask.Result as HttpWebResponse)
            {
                this.ParseSizeAndLastModified(webResponse);
            }
        }