/// <summary> /// Generates a web request to use to acquire, renew, change, release or break the lease for the container. /// </summary> /// <param name="uri">The absolute URI to the container.</param> /// <param name="timeout">The server timeout interval, in seconds.</param> /// <param name="action">The lease action to perform.</param> /// <param name="proposedLeaseId">A lease ID to propose for the result of an acquire or change operation, /// or null if no ID is proposed for an acquire operation. This should be null 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 null 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 null then the default time is used. This should be null for acquire, renew, change, and release operations.</param> /// <param name="accessCondition">The access condition to apply to the request.</param> /// <returns>A web request to use to perform the operation.</returns> public static StorageRequestMessage Lease(Uri uri, int?timeout, LeaseAction action, string proposedLeaseId, int?leaseDuration, int?leaseBreakPeriod, AccessCondition accessCondition, HttpContent content, OperationContext operationContext, ICanonicalizer canonicalizer, StorageCredentials credentials) { UriQueryBuilder builder = GetContainerUriQueryBuilder(); builder.Add(Constants.QueryConstants.Component, "lease"); StorageRequestMessage request = HttpRequestMessageFactory.CreateRequestMessage(HttpMethod.Put, uri, timeout, builder, content, operationContext, canonicalizer, credentials); // Add Headers BlobHttpRequestMessageFactory.AddLeaseAction(request, action); BlobHttpRequestMessageFactory.AddLeaseDuration(request, leaseDuration); BlobHttpRequestMessageFactory.AddProposedLeaseId(request, proposedLeaseId); BlobHttpRequestMessageFactory.AddLeaseBreakPeriod(request, leaseBreakPeriod); request.ApplyAccessCondition(accessCondition); return(request); }