Exemplo n.º 1
0
        /// <summary>
        /// Constructs a web request to return the blob's system properties.
        /// </summary>
        /// <param name="uri">The absolute URI to the blob.</param>
        /// <param name="timeout">The server timeout interval.</param>
        /// <param name="snapshot">The snapshot timestamp, if the blob is a snapshot.</param>
        /// <param name="leaseId">The lease ID.</param>
        /// <returns>A web request for performing the operation.</returns>
        public static HttpWebRequest GetProperties(Uri uri, int timeout, DateTime?snapshot, string leaseId)
        {
            UriQueryBuilder builder = new UriQueryBuilder();

            BlobRequest.AddSnapshot(builder, snapshot);

            var request = Request.GetProperties(uri, timeout, builder);

            Request.AddLeaseId(request, leaseId);
            return(request);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructs a web request to return the list of active page ranges for a page blob.
        /// </summary>
        /// <param name="uri">The absolute URI to the blob.</param>
        /// <param name="timeout">The server timeout interval.</param>
        /// <param name="snapshot">The snapshot timestamp, if the blob is a snapshot.</param>
        /// <param name="leaseId">The lease ID, if the blob has an active lease.</param>
        /// <returns>A web request to use to perform the operation.</returns>
        public static HttpWebRequest GetPageRanges(Uri uri, int timeout, DateTime?snapshot, string leaseId)
        {
            UriQueryBuilder builder = new UriQueryBuilder();

            builder.Add(Constants.QueryConstants.Component, "pagelist");

            BlobRequest.AddSnapshot(builder, snapshot);

            HttpWebRequest request = CreateWebRequest(uri, timeout, builder);

            request.Method = "GET";

            Request.AddLeaseId(request, leaseId);

            return(request);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructs a web request to get the blob's content, properties, and metadata.
        /// </summary>
        /// <param name="uri">The absolute URI to the blob.</param>
        /// <param name="timeout">The server timeout interval.</param>
        /// <param name="snapshot">The snapshot version, if the blob is a snapshot.</param>
        /// <param name="leaseId">The lease ID for the blob, if it has an active lease.</param>
        /// <returns>A web request for performing the operation.</returns>
        public static HttpWebRequest Get(Uri uri, int timeout, DateTime?snapshot, string leaseId)
        {
            UriQueryBuilder builder = new UriQueryBuilder();

            BlobRequest.AddSnapshot(builder, snapshot);

            HttpWebRequest request = CreateWebRequest(uri, timeout, builder);

            request.Method = "GET";

            if (leaseId != null)
            {
                Request.AddLeaseId(request, leaseId);
            }

            return(request);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Constructs a web request to return the list of blocks for a block blob.
        /// </summary>
        /// <param name="uri">The absolute URI to the blob.</param>
        /// <param name="timeout">The server timeout interval.</param>
        /// <param name="snapshot">The snapshot timestamp, if the blob is a snapshot.</param>
        /// <param name="typesOfBlocks">The types of blocks to include in the list: committed, uncommitted, or both.</param>
        /// <param name="leaseId">The lease ID for the blob, if it has an active lease.</param>
        /// <returns>A web request to use to perform the operation.</returns>
        public static HttpWebRequest GetBlockList(Uri uri, int timeout, DateTime?snapshot, BlockListingFilter typesOfBlocks, string leaseId)
        {
            UriQueryBuilder builder = new UriQueryBuilder();

            builder.Add(Constants.QueryConstants.Component, "blocklist");

            builder.Add("blocklisttype", typesOfBlocks.ToString());

            BlobRequest.AddSnapshot(builder, snapshot);

            HttpWebRequest request = CreateWebRequest(uri, timeout, builder);

            request.Method = "GET";

            Request.AddLeaseId(request, leaseId);

            return(request);
        }