public static StorageOperationTypes GetBlobOperation(string requestMethod, RequestUriParts requestUriParts, RequestQueryParameters queryParams, RequestHeaders headers) { var requestAttributes = new RequestAttributes { Method = new HttpMethod(requestMethod), UriParts = requestUriParts, QueryParams = queryParams, Headers = headers, }; if (requestUriParts.IsAccountRequest) { return LookupBlobOperation(requestAttributes, _accountOperations); } else if (requestUriParts.IsContainerRequest) { return LookupBlobOperation(requestAttributes, _containerOperations); } else if (requestUriParts.IsBlobRequest) { return LookupBlobOperation(requestAttributes, _blobOperations); } else { System.Diagnostics.Debug.Assert(false); } return StorageOperationTypes.Unknown; }
static string GetCanonicalizedResource(RequestUriParts uriParts, string resourceType, DateTimeOffset sasVersion) { // The implementation seems out of sync with the documentation wrt leading slash - going with the implementation & // hoping we don't have to support both formats! if (resourceType[0] == 'c') { return String.Format("{0}/{1}/{2}", sasVersion >= StorageServiceVersions.Version_2015_02_21 ? "/blob" : String.Empty, SharedKeySignature.AccountName, uriParts.Container); } else if (resourceType[0] == 'b') { return String.Format("{0}/{1}{2}", sasVersion >= StorageServiceVersions.Version_2015_02_21 ? "/blob" : String.Empty, SharedKeySignature.AccountName, uriParts.PublicUriPath); } return String.Empty; }
static string GetCanonicalizedResource(RequestUriParts uriParts, string resourceType) { if (resourceType[0] == 'c') { return String.Format("/{0}/{1}", SharedKeySignature.AccountName, uriParts.Container); } else if (resourceType[0] == 'b') { return String.Format("/{0}{1}", SharedKeySignature.AccountName, uriParts.PublicUriPath); } return String.Empty; }