Exemple #1
0
 /// <summary>
 /// Constructs a web request to create a new container.
 /// </summary>
 /// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the container.</param>
 /// <param name="timeout">An integer specifying the server timeout interval.</param>
 /// <param name="useVersionHeader">A boolean value indicating whether to set the <i>x-ms-version</i> HTTP header.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
 /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
 public static HttpWebRequest Create(Uri uri, int?timeout, bool useVersionHeader, OperationContext operationContext)
 {
     return(ContainerHttpWebRequestFactory.Create(uri, timeout, useVersionHeader, operationContext, BlobContainerPublicAccessType.Off));
 }
Exemple #2
0
 /// <summary>
 /// Constructs a web request to create a new container.
 /// </summary>
 /// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the container.</param>
 /// <param name="timeout">An integer specifying the server timeout interval.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
 /// <param name="accessType">An <see cref="BlobContainerPublicAccessType"/> object that specifies whether data in the container may be accessed publicly and the level of access.</param>
 /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
 public static HttpWebRequest Create(Uri uri, int?timeout, OperationContext operationContext, BlobContainerPublicAccessType accessType)
 {
     return(ContainerHttpWebRequestFactory.Create(uri, timeout, true /* useVersionHeader */, operationContext, accessType));
 }
Exemple #3
0
 /// <summary>
 /// Generates a web request to return a listing of all blobs in the container.
 /// </summary>
 /// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the container.</param>
 /// <param name="timeout">An integer specifying the server timeout interval.</param>
 /// <param name="listingContext">A <see cref="ListingContext"/> object.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
 /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
 public static HttpWebRequest ListBlobs(Uri uri, int?timeout, BlobListingContext listingContext, OperationContext operationContext)
 {
     return(ContainerHttpWebRequestFactory.ListBlobs(uri, timeout, listingContext, true /* useVersionHeader */, operationContext));
 }
Exemple #4
0
        /// <summary>
        /// Generates a web request to return a listing of all blobs in the container.
        /// </summary>
        /// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the container.</param>
        /// <param name="timeout">An integer specifying the server timeout interval.</param>
        /// <param name="listingContext">A <see cref="ListingContext"/> object.</param>
        /// <param name="useVersionHeader">A boolean value indicating whether to set the <i>x-ms-version</i> HTTP header.</param>
        /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
        /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
        public static HttpWebRequest ListBlobs(Uri uri, int?timeout, BlobListingContext listingContext, bool useVersionHeader, OperationContext operationContext)
        {
            UriQueryBuilder builder = ContainerHttpWebRequestFactory.GetContainerUriQueryBuilder();

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

            if (listingContext != null)
            {
                if (listingContext.Prefix != null)
                {
                    builder.Add("prefix", listingContext.Prefix);
                }

                if (listingContext.Delimiter != null)
                {
                    builder.Add("delimiter", listingContext.Delimiter);
                }

                if (listingContext.Marker != null)
                {
                    builder.Add("marker", listingContext.Marker);
                }

                if (listingContext.MaxResults.HasValue)
                {
                    builder.Add("maxresults", listingContext.MaxResults.ToString());
                }

                if (listingContext.Details != BlobListingDetails.None)
                {
                    StringBuilder sb = new StringBuilder();

                    bool started = false;

                    if ((listingContext.Details & BlobListingDetails.Snapshots) == BlobListingDetails.Snapshots)
                    {
                        if (!started)
                        {
                            started = true;
                        }
                        else
                        {
                            sb.Append(",");
                        }

                        sb.Append("snapshots");
                    }

                    if ((listingContext.Details & BlobListingDetails.UncommittedBlobs) == BlobListingDetails.UncommittedBlobs)
                    {
                        if (!started)
                        {
                            started = true;
                        }
                        else
                        {
                            sb.Append(",");
                        }

                        sb.Append("uncommittedblobs");
                    }

                    if ((listingContext.Details & BlobListingDetails.Metadata) == BlobListingDetails.Metadata)
                    {
                        if (!started)
                        {
                            started = true;
                        }
                        else
                        {
                            sb.Append(",");
                        }

                        sb.Append("metadata");
                    }

                    if ((listingContext.Details & BlobListingDetails.Copy) == BlobListingDetails.Copy)
                    {
                        if (!started)
                        {
                            started = true;
                        }
                        else
                        {
                            sb.Append(",");
                        }

                        sb.Append("copy");
                    }

                    builder.Add("include", sb.ToString());
                }
            }

            HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Get, uri, timeout, builder, useVersionHeader, operationContext);

            return(request);
        }
Exemple #5
0
 /// <summary>
 /// Constructs a web request to set the ACL for a container.
 /// </summary>
 /// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the container.</param>
 /// <param name="timeout">An integer specifying the server timeout interval.</param>
 /// <param name="publicAccess">The type of public access to allow for the container.</param>
 /// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
 /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
 public static HttpWebRequest SetAcl(Uri uri, int?timeout, BlobContainerPublicAccessType publicAccess, AccessCondition accessCondition, OperationContext operationContext)
 {
     return(ContainerHttpWebRequestFactory.SetAcl(uri, timeout, publicAccess, accessCondition, true /* useVersionHeader */, operationContext));
 }
Exemple #6
0
 /// <summary>
 /// Constructs a web request to return a listing of all containers in this storage account.
 /// </summary>
 /// <param name="uri">A <see cref="System.Uri"/> specifying the Blob service endpoint.</param>
 /// <param name="timeout">An integer specifying the server timeout interval.</param>
 /// <param name="listingContext">A <see cref="ListingContext"/> object.</param>
 /// <param name="detailsIncluded">A <see cref="ContainerListingDetails"/> enumeration value that indicates whether to return container metadata with the listing.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
 /// <returns>A web request for the specified operation.</returns>
 public static HttpWebRequest List(Uri uri, int?timeout, ListingContext listingContext, ContainerListingDetails detailsIncluded, OperationContext operationContext)
 {
     return(ContainerHttpWebRequestFactory.List(uri, timeout, listingContext, detailsIncluded, true /* useVersionHeader */, operationContext));
 }
Exemple #7
0
 /// <summary>
 /// Generates a web request to use to acquire, renew, change, release or break the lease for the container.
 /// </summary>
 /// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the container.</param>
 /// <param name="timeout">An integer specifying the server timeout interval.</param>
 /// <param name="action">A <see cref="LeaseAction"/> enumeration value indicating the lease action to perform.</param>
 /// <param name="proposedLeaseId">A string specifying the lease ID to propose for the result of an acquire or change operation,
 /// or <c>null</c> if no ID is proposed for an acquire operation. This parameter should be <c>null</c> for renew, release, and break operations.</param>
 /// <param name="leaseDuration">The lease duration, in seconds, for acquire operations.
 /// If this is -1 then an infinite duration is specified. This should be <c>null</c> for renew, change, release, and break operations.</param>
 /// <param name="leaseBreakPeriod">The amount of time to wait, in seconds, after a break operation before the lease is broken.
 /// If this is <c>null</c> then the default time is used. This should be <c>null</c> for acquire, renew, change, and release operations.</param>
 /// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
 /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
 public static HttpWebRequest Lease(Uri uri, int?timeout, LeaseAction action, string proposedLeaseId, int?leaseDuration, int?leaseBreakPeriod, AccessCondition accessCondition, OperationContext operationContext)
 {
     return(ContainerHttpWebRequestFactory.Lease(uri, timeout, action, proposedLeaseId, leaseDuration, leaseBreakPeriod, accessCondition, true /* useVersionHeader */, operationContext));
 }
Exemple #8
0
 /// <summary>
 /// Generates a web request to set user-defined metadata for the container.
 /// </summary>
 /// <param name="uri">A <see cref="System.Uri"/> specifying the absolute URI to the container.</param>
 /// <param name="timeout">An integer specifying the server timeout interval.</param>
 /// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
 /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
 public static HttpWebRequest SetMetadata(Uri uri, int?timeout, AccessCondition accessCondition, OperationContext operationContext)
 {
     return(ContainerHttpWebRequestFactory.SetMetadata(uri, timeout, accessCondition, true /* useVersionHeader */, operationContext));
 }
 /// <summary>
 /// Creates a web request to get the properties of the Blob service account.
 /// </summary>
 /// <param name="uri">A <see cref="System.Uri"/> specifying the Blob service endpoint.</param>
 /// <param name="builder">A <see cref="UriQueryBuilder"/> object specifying additional parameters to add to the URI query string.</param>
 /// <param name="timeout">The server timeout interval, in seconds.</param>
 /// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
 /// <returns>A <see cref="System.Net.HttpWebRequest"/> object.</returns>
 public static HttpWebRequest GetAccountProperties(Uri uri, UriQueryBuilder builder, int?timeout, OperationContext operationContext)
 {
     return(ContainerHttpWebRequestFactory.GetAccountProperties(uri, builder, timeout, true /* useVersionHeader */, operationContext));
 }