diff --git a/sdk/storage/azure-storage-blob/CHANGELOG.md b/sdk/storage/azure-storage-blob/CHANGELOG.md index 21c8615c8ced..699d9690e885 100644 --- a/sdk/storage/azure-storage-blob/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob/CHANGELOG.md @@ -1,8 +1,11 @@ # Change Log azure-storage-blob +## Version XX.X.X (XXXX-XX-XX) +- Added SAS generation methods on clients to improve discoverability and convenience of sas. Deprecated setContainerName, setBlobName, setSnapshotId, generateSasQueryParameters methods on BlobServiceSasSignatureValues to direct users to using the methods added on clients. +- Fixed a bug where Account SAS would not work when set on clients. + ## Version 12.1.0 (2019-12-04) This package's -This package's [documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-blob_12.1.0/sdk/storage/azure-storage-blob/README.md) and [samples](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-blob_12.1.0/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob) @@ -21,7 +24,7 @@ and - Removed BlobClientBuilder, BlobContainerClientBuilder, BlobServiceClientBuilder, and SpecializedBlobClientBuilder inheritance of BaseBlobClientBuilder - Renamed ListBlobContainerOptions getMaxResults and setMaxResults to getMaxResultsPerPage and setMaxResultsPerPage - Renamed ListBlobsOptions getMaxResults and setMaxResults to getMaxResultsPerPage and setMaxResultsPerPage -- Reanmed BlobProperties to BlobItemProperties and BlobContainerProperties to BlobContainerItemProperties +- Renamed BlobProperties to BlobItemProperties and BlobContainerProperties to BlobContainerItemProperties - Removes StorageError and StorageErrorException from public API - Renamed StorageErrorCode to BlobErrorCode, SignedIdentifier to BlobSignedIdentifier, StorageServiceProperties to BlobServiceProperties, StorageServiceStats to BlobServiceStatistics, CorRules to BlobCorRules, AccessPolicy to BlobAccessPolicy, Logging to BlobAnalyticsLogging, Metrics to BlobMetrics, and RetentionPolicy to BlobRetentionPolicy - Renamed BlobHTTPHeaders to BlobHttpHeaders and removed Blob from getter names diff --git a/sdk/storage/azure-storage-blob/pom.xml b/sdk/storage/azure-storage-blob/pom.xml index 342acca2d81e..6b7affc7ac3d 100644 --- a/sdk/storage/azure-storage-blob/pom.xml +++ b/sdk/storage/azure-storage-blob/pom.xml @@ -277,6 +277,7 @@ --add-opens com.azure.storage.common/com.azure.storage.common.sas=ALL-UNNAMED --add-opens com.azure.storage.blob/com.azure.storage.blob=ALL-UNNAMED --add-opens com.azure.storage.blob/com.azure.storage.blob.implementation=ALL-UNNAMED + --add-opens com.azure.storage.blob/com.azure.storage.blob.implementation.util=ALL-UNNAMED --add-opens com.azure.storage.blob/com.azure.storage.blob.specialized=ALL-UNNAMED --add-reads com.azure.core=ALL-UNNAMED --add-reads com.azure.core.test=ALL-UNNAMED diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerAsyncClient.java index 907d5a4e3d73..d0456b868a42 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerAsyncClient.java @@ -20,6 +20,7 @@ import com.azure.storage.blob.implementation.models.ContainerGetPropertiesHeaders; import com.azure.storage.blob.implementation.models.ContainersListBlobFlatSegmentResponse; import com.azure.storage.blob.implementation.models.ContainersListBlobHierarchySegmentResponse; +import com.azure.storage.blob.implementation.util.BlobSasImplUtil; import com.azure.storage.blob.models.BlobContainerAccessPolicies; import com.azure.storage.blob.models.BlobContainerProperties; import com.azure.storage.blob.models.BlobItem; @@ -30,11 +31,16 @@ import com.azure.storage.blob.models.ListBlobsOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.UserDelegationKey; +import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; +import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.Utility; +import com.azure.storage.common.implementation.SasImplUtils; import com.azure.storage.common.implementation.StorageImplUtils; import reactor.core.publisher.Mono; import java.time.Duration; +import java.time.OffsetDateTime; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; @@ -900,6 +906,44 @@ Mono> getAccountInfoWithResponse(Context context) { }); } + /** + * Generates a user delegation SAS for the container using the specified {@link BlobServiceSasSignatureValues}. + *

See {@link BlobServiceSasSignatureValues} for more information on how to construct a user delegation SAS.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobContainerAsyncClient.generateUserDelegationSas#BlobServiceSasSignatureValues-UserDelegationKey} + * + * @param blobServiceSasSignatureValues {@link BlobServiceSasSignatureValues} + * @param userDelegationKey A {@link UserDelegationKey} object used to sign the SAS values. + * @see BlobServiceAsyncClient#getUserDelegationKey(OffsetDateTime, OffsetDateTime) for more information on how to + * get a user delegation key. + * + * @return A {@code String} representing all SAS query parameters. + */ + public String generateUserDelegationSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues, + UserDelegationKey userDelegationKey) { + return new BlobSasImplUtil(blobServiceSasSignatureValues, getBlobContainerName()) + .generateUserDelegationSas(userDelegationKey, getAccountName()); + } + + /** + * Generates a service SAS for the container using the specified {@link BlobServiceSasSignatureValues} + * Note : The client must be authenticated via {@link StorageSharedKeyCredential} + *

See {@link BlobServiceSasSignatureValues} for more information on how to construct a service SAS.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobContainerAsyncClient.generateSas#BlobServiceSasSignatureValues} + * + * @param blobServiceSasSignatureValues {@link BlobServiceSasSignatureValues} + * + * @return A {@code String} representing all SAS query parameters. + */ + public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues) { + return new BlobSasImplUtil(blobServiceSasSignatureValues, getBlobContainerName()) + .generateSas(SasImplUtils.extractSharedKeyCredential(getHttpPipeline())); + } private boolean validateNoETag(BlobRequestConditions modifiedRequestConditions) { if (modifiedRequestConditions == null) { diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClient.java index 6750a52b9605..f5b48e7637a9 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClient.java @@ -17,9 +17,13 @@ import com.azure.storage.blob.models.ListBlobsOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.UserDelegationKey; +import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; +import com.azure.storage.common.StorageSharedKeyCredential; import reactor.core.publisher.Mono; import java.time.Duration; +import java.time.OffsetDateTime; import java.util.List; import java.util.Map; @@ -552,4 +556,41 @@ public Response getAccountInfoWithResponse(Duration timeout, return blockWithOptionalTimeout(response, timeout); } + + /** + * Generates a user delegation SAS for the container using the specified {@link BlobServiceSasSignatureValues}. + *

See {@link BlobServiceSasSignatureValues} for more information on how to construct a user delegation SAS.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobContainerClient.generateUserDelegationSas#BlobServiceSasSignatureValues-UserDelegationKey} + * + * @param blobServiceSasSignatureValues {@link BlobServiceSasSignatureValues} + * @param userDelegationKey A {@link UserDelegationKey} object used to sign the SAS values. + * @see BlobServiceClient#getUserDelegationKey(OffsetDateTime, OffsetDateTime) for more information on how to get a + * user delegation key. + * + * @return A {@code String} representing all SAS query parameters. + */ + public String generateUserDelegationSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues, + UserDelegationKey userDelegationKey) { + return this.client.generateUserDelegationSas(blobServiceSasSignatureValues, userDelegationKey); + } + + /** + * Generates a service SAS for the container using the specified {@link BlobServiceSasSignatureValues} + * Note : The client must be authenticated via {@link StorageSharedKeyCredential} + *

See {@link BlobServiceSasSignatureValues} for more information on how to construct a service SAS.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobContainerClient.generateSas#BlobServiceSasSignatureValues} + * + * @param blobServiceSasSignatureValues {@link BlobServiceSasSignatureValues} + * + * @return A {@code String} representing all SAS query parameters. + */ + public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues) { + return this.client.generateSas(blobServiceSasSignatureValues); + } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index d010d3cd24d5..312ca68beafa 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -28,8 +28,12 @@ import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; import com.azure.storage.blob.models.UserDelegationKey; +import com.azure.storage.common.StorageSharedKeyCredential; +import com.azure.storage.common.implementation.AccountSasImplUtil; import com.azure.storage.common.implementation.Constants; +import com.azure.storage.common.implementation.SasImplUtils; import com.azure.storage.common.implementation.StorageImplUtils; +import com.azure.storage.common.sas.AccountSasSignatureValues; import reactor.core.publisher.Mono; import java.time.Duration; @@ -551,4 +555,22 @@ Mono> getAccountInfoWithResponse(Context context) { public String getAccountName() { return this.accountName; } + + /** + * Generates an account SAS for the Azure Storage account using the specified {@link AccountSasSignatureValues}. + * Note : The client must be authenticated via {@link StorageSharedKeyCredential} + *

See {@link AccountSasSignatureValues} for more information on how to construct an account SAS.

+ * + *

The snippet below generates a SAS that lasts for two days and gives the user read and list access to blob + * containers and file shares.

+ * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.generateAccountSas#AccountSasSignatureValues} + * + * @param accountSasSignatureValues {@link AccountSasSignatureValues} + * + * @return A {@code String} representing all SAS query parameters. + */ + public String generateAccountSas(AccountSasSignatureValues accountSasSignatureValues) { + return new AccountSasImplUtil(accountSasSignatureValues) + .generateSas(SasImplUtils.extractSharedKeyCredential(getHttpPipeline())); + } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java index a418caae2769..7ab7cc05ee3d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java @@ -17,7 +17,9 @@ import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; import com.azure.storage.blob.models.UserDelegationKey; +import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.implementation.StorageImplUtils; +import com.azure.storage.common.sas.AccountSasSignatureValues; import reactor.core.publisher.Mono; import java.time.Duration; @@ -372,4 +374,22 @@ public Response getAccountInfoWithResponse(Duration timeout, public String getAccountName() { return this.blobServiceAsyncClient.getAccountName(); } + + /** + * Generates an account SAS for the Azure Storage account using the specified {@link AccountSasSignatureValues}. + * Note : The client must be authenticated via {@link StorageSharedKeyCredential} + *

See {@link AccountSasSignatureValues} for more information on how to construct an account SAS.

+ * + *

Generating an account SAS

+ *

The snippet below generates an AccountSasSignatureValues object that lasts for two days and gives the user + * read and list access to blob and file shares.

+ * {@codesnippet com.azure.storage.blob.BlobServiceClient.generateAccountSas#AccountSasSignatureValues} + * + * @param accountSasSignatureValues {@link AccountSasSignatureValues} + * + * @return A {@code String} representing all SAS query parameters. + */ + public String generateAccountSas(AccountSasSignatureValues accountSasSignatureValues) { + return this.blobServiceAsyncClient.generateAccountSas(accountSasSignatureValues); + } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/BlobSasImplUtil.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/BlobSasImplUtil.java new file mode 100644 index 000000000000..e0805b945c2d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/BlobSasImplUtil.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob.implementation.util; + +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.blob.BlobServiceVersion; +import com.azure.storage.blob.models.UserDelegationKey; +import com.azure.storage.blob.sas.BlobContainerSasPermission; +import com.azure.storage.blob.sas.BlobSasPermission; +import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; +import com.azure.storage.common.StorageSharedKeyCredential; +import com.azure.storage.common.implementation.Constants; +import com.azure.storage.common.implementation.StorageImplUtils; +import com.azure.storage.common.sas.SasIpRange; +import com.azure.storage.common.sas.SasProtocol; + +import java.time.OffsetDateTime; +import java.util.Objects; + +import static com.azure.storage.common.implementation.SasImplUtils.formatQueryParameterDate; +import static com.azure.storage.common.implementation.SasImplUtils.tryAppendQueryParameter; + +/** + * This class provides helper methods for common blob service sas patterns. + * + * RESERVED FOR INTERNAL USE. + */ +public class BlobSasImplUtil { + /** + * The SAS blob constant. + */ + private static final String SAS_BLOB_CONSTANT = "b"; + + /** + * The SAS blob snapshot constant. + */ + private static final String SAS_BLOB_SNAPSHOT_CONSTANT = "bs"; + + /** + * The SAS blob container constant. + */ + private static final String SAS_CONTAINER_CONSTANT = "c"; + + private final ClientLogger logger = new ClientLogger(BlobSasImplUtil.class); + + private String version; + + private SasProtocol protocol; + + private OffsetDateTime startTime; + + private OffsetDateTime expiryTime; + + private String permissions; + + private SasIpRange sasIpRange; + + private String containerName; + + private String blobName; + + private String resource; + + private String snapshotId; + + private String identifier; + + private String cacheControl; + + private String contentDisposition; + + private String contentEncoding; + + private String contentLanguage; + + private String contentType; + + /** + * Creates a new {@link BlobSasImplUtil} with the specified parameters + * + * @param sasValues {@link BlobServiceSasSignatureValues} + * @param containerName The container name + */ + public BlobSasImplUtil(BlobServiceSasSignatureValues sasValues, String containerName) { + this(sasValues, containerName, null, null); + } + + /** + * Creates a new {@link BlobSasImplUtil} with the specified parameters + * + * @param sasValues {@link BlobServiceSasSignatureValues} + * @param containerName The container name + * @param blobName The blob name + * @param snapshotId The snapshot id + */ + public BlobSasImplUtil(BlobServiceSasSignatureValues sasValues, String containerName, String blobName, + String snapshotId) { + Objects.requireNonNull(sasValues); + this.version = sasValues.getVersion(); + this.protocol = sasValues.getProtocol(); + this.startTime = sasValues.getStartTime(); + this.expiryTime = sasValues.getExpiryTime(); + this.permissions = sasValues.getPermissions(); + this.sasIpRange = sasValues.getSasIpRange(); + this.containerName = containerName; + this.blobName = blobName; + this.snapshotId = snapshotId; + this.identifier = sasValues.getIdentifier(); + this.cacheControl = sasValues.getCacheControl(); + this.contentDisposition = sasValues.getContentDisposition(); + this.contentEncoding = sasValues.getContentEncoding(); + this.contentLanguage = sasValues.getContentLanguage(); + this.contentType = sasValues.getContentType(); + } + + /** + * Generates a Sas signed with a {@link StorageSharedKeyCredential} + * + * @param storageSharedKeyCredentials {@link StorageSharedKeyCredential} + * @return A String representing the Sas + */ + public String generateSas(StorageSharedKeyCredential storageSharedKeyCredentials) { + StorageImplUtils.assertNotNull("storageSharedKeyCredentials", storageSharedKeyCredentials); + + ensureState(); + + // Signature is generated on the un-url-encoded values. + final String canonicalName = getCanonicalName(storageSharedKeyCredentials.getAccountName()); + final String signature = storageSharedKeyCredentials.computeHmac256(stringToSign(canonicalName)); + + return encode(null /* userDelegationKey */, signature); + } + + /** + * Generates a Sas signed with a {@link UserDelegationKey} + * + * @param delegationKey {@link UserDelegationKey} + * @param accountName The account name + * @return A String representing the Sas + */ + public String generateUserDelegationSas(UserDelegationKey delegationKey, String accountName) { + StorageImplUtils.assertNotNull("delegationKey", delegationKey); + StorageImplUtils.assertNotNull("accountName", accountName); + + ensureState(); + + // Signature is generated on the un-url-encoded values. + final String canonicalName = getCanonicalName(accountName); + String signature = StorageImplUtils.computeHMac256( + delegationKey.getValue(), stringToSign(delegationKey, canonicalName)); + + return encode(delegationKey, signature); + } + + /** + * Encodes a Sas from the values in this type. + * @param userDelegationKey {@link UserDelegationKey} + * @param signature The signature of the Sas. + * @return A String representing the Sas. + */ + private String encode(UserDelegationKey userDelegationKey, String signature) { + /* + We should be url-encoding each key and each value, but because we know all the keys and values will encode to + themselves, we cheat except for the signature value. + */ + StringBuilder sb = new StringBuilder(); + + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SERVICE_VERSION, this.version); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_PROTOCOL, this.protocol); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_START_TIME, formatQueryParameterDate(this.startTime)); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_EXPIRY_TIME, formatQueryParameterDate(this.expiryTime)); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_IP_RANGE, this.sasIpRange); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_IDENTIFIER, this.identifier); + if (userDelegationKey != null) { + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_OBJECT_ID, + userDelegationKey.getSignedObjectId()); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_TENANT_ID, + userDelegationKey.getSignedTenantId()); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_START, + formatQueryParameterDate(userDelegationKey.getSignedStart())); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_EXPIRY, + formatQueryParameterDate(userDelegationKey.getSignedExpiry())); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_SERVICE, + userDelegationKey.getSignedService()); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_VERSION, + userDelegationKey.getSignedVersion()); + } + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_RESOURCE, this.resource); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_PERMISSIONS, this.permissions); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNATURE, signature); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CACHE_CONTROL, this.cacheControl); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_DISPOSITION, this.contentDisposition); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_ENCODING, this.contentEncoding); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_LANGUAGE, this.contentLanguage); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_TYPE, this.contentType); + + return sb.toString(); + + } + + /** + * Ensures that the builder's properties are in a consistent state. + + * 1. If there is no version, use latest. + * 2. If there is no identifier set, ensure expiryTime and permissions are set. + * 3. Resource name is chosen by: + * a. If "BlobName" is _not_ set, it is a container resource. + * b. Otherwise, if "SnapshotId" is set, it is a blob snapshot resource. + * c. Otherwise, it is a blob resource. + * 4. Reparse permissions depending on what the resource is. If it is an unrecognised resource, do nothing. + * + * Taken from: + * https://github.com/Azure/azure-storage-blob-go/blob/master/azblob/sas_service.go#L33 + * https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/storage/Azure.Storage.Blobs/src/Sas/BlobSasBuilder.cs + */ + private void ensureState() { + if (version == null) { + version = BlobServiceVersion.getLatest().getVersion(); + } + + if (identifier == null) { + if (expiryTime == null || permissions == null) { + throw logger.logExceptionAsError(new IllegalStateException("If identifier is not set, expiry time " + + "and permissions must be set")); + } + } + + if (CoreUtils.isNullOrEmpty(blobName)) { + resource = SAS_CONTAINER_CONSTANT; + } else if (snapshotId != null) { + resource = SAS_BLOB_SNAPSHOT_CONSTANT; + } else { + resource = SAS_BLOB_CONSTANT; + } + + if (permissions != null) { + switch (resource) { + case SAS_BLOB_CONSTANT: + case SAS_BLOB_SNAPSHOT_CONSTANT: + permissions = BlobSasPermission.parse(permissions).toString(); + break; + case SAS_CONTAINER_CONSTANT: + permissions = BlobContainerSasPermission.parse(permissions).toString(); + break; + default: + // We won't reparse the permissions if we don't know the type. + logger.info("Not re-parsing permissions. Resource type '{}' is unknown.", resource); + break; + } + } + } + + /** + * Computes the canonical name for a container or blob resource for SAS signing. + */ + private String getCanonicalName(String account) { + // Container: "/blob/account/containername" + // Blob: "/blob/account/containername/blobname" + return CoreUtils.isNullOrEmpty(blobName) + ? String.format("/blob/%s/%s", account, containerName) + : String.format("/blob/%s/%s/%s", account, containerName, blobName.replace("\\", "/")); + } + + private String stringToSign(String canonicalName) { + return String.join("\n", + this.permissions == null ? "" : permissions, + this.startTime == null ? "" : Constants.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), + this.expiryTime == null ? "" : Constants.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), + canonicalName, + this.identifier == null ? "" : this.identifier, + this.sasIpRange == null ? "" : this.sasIpRange.toString(), + this.protocol == null ? "" : this.protocol.toString(), + version, + resource, + this.snapshotId == null ? "" : this.snapshotId, + this.cacheControl == null ? "" : this.cacheControl, + this.contentDisposition == null ? "" : this.contentDisposition, + this.contentEncoding == null ? "" : this.contentEncoding, + this.contentLanguage == null ? "" : this.contentLanguage, + this.contentType == null ? "" : this.contentType + ); + } + + private String stringToSign(final UserDelegationKey key, String canonicalName) { + return String.join("\n", + this.permissions == null ? "" : this.permissions, + this.startTime == null ? "" : Constants.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), + this.expiryTime == null ? "" : Constants.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), + canonicalName, + key.getSignedObjectId() == null ? "" : key.getSignedObjectId(), + key.getSignedTenantId() == null ? "" : key.getSignedTenantId(), + key.getSignedStart() == null ? "" : Constants.ISO_8601_UTC_DATE_FORMATTER.format(key.getSignedStart()), + key.getSignedExpiry() == null ? "" : Constants.ISO_8601_UTC_DATE_FORMATTER.format(key.getSignedExpiry()), + key.getSignedService() == null ? "" : key.getSignedService(), + key.getSignedVersion() == null ? "" : key.getSignedVersion(), + this.sasIpRange == null ? "" : this.sasIpRange.toString(), + this.protocol == null ? "" : this.protocol.toString(), + version, + resource, + this.snapshotId == null ? "" : this.snapshotId, + this.cacheControl == null ? "" : this.cacheControl, + this.contentDisposition == null ? "" : this.contentDisposition, + this.contentEncoding == null ? "" : this.contentEncoding, + this.contentLanguage == null ? "" : this.contentLanguage, + this.contentType == null ? "" : this.contentType + ); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobServiceSasQueryParameters.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobServiceSasQueryParameters.java index 69f5e2515213..b87f119c34c7 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobServiceSasQueryParameters.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobServiceSasQueryParameters.java @@ -21,7 +21,10 @@ * appended to a URL directly (though caution should be taken here in case there are existing query parameters, which * might affect the appropriate means of appending these query parameters). NOTE: Instances of this class are immutable * to ensure thread safety. + * @deprecated Please use the generateSas method on the desired blob/container client after initializing + * {@link BlobServiceSasSignatureValues}. */ +@Deprecated public final class BlobServiceSasQueryParameters extends BaseSasQueryParameters { private final String identifier; @@ -56,7 +59,9 @@ public final class BlobServiceSasQueryParameters extends BaseSasQueryParameters * @param queryParamsMap All query parameters for the request as key-value pairs * @param removeSasParametersFromMap When {@code true}, the SAS query parameters will be removed from * queryParamsMap + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public BlobServiceSasQueryParameters(Map queryParamsMap, boolean removeSasParametersFromMap) { super(queryParamsMap, removeSasParametersFromMap); this.identifier = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_IDENTIFIER, @@ -101,7 +106,9 @@ public BlobServiceSasQueryParameters(Map queryParamsMap, boole * @param resource A {@code String} representing the storage container or blob (only for Service SAS). * @param permissions A {@code String} representing the storage permissions or {@code null}. * @param signature A {@code String} representing the signature for the SAS token. + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated BlobServiceSasQueryParameters(String version, SasProtocol protocol, OffsetDateTime startTime, OffsetDateTime expiryTime, SasIpRange sasIpRange, String identifier, String resource, String permissions, String signature, String cacheControl, String contentDisposition, String contentEncoding, @@ -137,95 +144,122 @@ public BlobServiceSasQueryParameters(Map queryParamsMap, boole * @return The signed identifier (only for {@link BlobServiceSasSignatureValues}) or {@code null}. Please see * here * for more information. + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public String getIdentifier() { return identifier; } /** * @return The storage container or blob (only for {@link BlobServiceSasSignatureValues}). + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public String getResource() { return resource; } /** * @return The Cache-Control header value when a client accesses the resource with this sas token. + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public String getCacheControl() { return cacheControl; } /** * @return The Content-Disposition header value when a client accesses the resource with this sas token. + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public String getContentDisposition() { return contentDisposition; } /** * @return The Content-Encoding header value when a client accesses the resource with this sas token. + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public String getContentEncoding() { return contentEncoding; } /** * @return The Content-Language header value when a client accesses the resource with this sas token. + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public String getContentLanguage() { return contentLanguage; } /** * @return The Content-Type header value when a client accesses the resource with this sas token. + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public String getContentType() { return contentType; } /** * @return the object ID of the key. + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public String getKeyObjectId() { return keyObjectId; } /** * @return the tenant ID of the key. + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public String getKeyTenantId() { return keyTenantId; } /** * @return the datetime when the key becomes active. + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public OffsetDateTime getKeyStart() { return keyStart; } /** * @return the datetime when the key expires. + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public OffsetDateTime getKeyExpiry() { return keyExpiry; } /** * @return the services that are permitted by the key. + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public String getKeyService() { return keyService; } /** * @return the service version that created the key. + * @deprecated Please use {@link BlobServiceSasSignatureValues} */ + @Deprecated public String getKeyVersion() { return keyVersion; } + @Deprecated UserDelegationKey userDelegationKey() { return new UserDelegationKey() .setSignedExpiry(this.keyExpiry) @@ -240,7 +274,10 @@ UserDelegationKey userDelegationKey() { * Encodes all SAS query parameters into a string that can be appended to a URL. * * @return A {@code String} representing all SAS query parameters. + * @deprecated Please use the generateSas method on the desired blob/container client after initializing + * {@link BlobServiceSasSignatureValues}. */ + @Deprecated public String encode() { /* We should be url-encoding each key and each value, but because we know all the keys and values will encode to diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobServiceSasSignatureValues.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobServiceSasSignatureValues.java index 5f878a5468fa..8daced5eef70 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobServiceSasSignatureValues.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/sas/BlobServiceSasSignatureValues.java @@ -15,27 +15,18 @@ import com.azure.storage.common.sas.SasProtocol; import java.time.OffsetDateTime; + /** - * Used to generate a Shared Access Signature (SAS) for an Azure Blob Storage service. Once all the values here are set, - * call {@link - * #generateSasQueryParameters(StorageSharedKeyCredential) generateSasQueryParameters(StorageSharedKeyCredential)} or - * {@link #generateSasQueryParameters(UserDelegationKey, String) generateSasQueryParameters(UserDelegationKey, String)} - * to obtain a representation of the SAS which can be applied to blob urls. - * - *

Generating SAS query parameters with {@link StorageSharedKeyCredential}

- * The following code generates SAS query parameters for an Azure storage blob. - *

- * {@codesnippet com.azure.storage.blob.specialized.BlobServiceSasSignatureValues.generateSasQueryParameters#StorageSharedKeyCredential} - * - *

Generating SAS query parameters with {@link UserDelegationKey}

- * The following sample generates SAS query parameters for an Azure storage container. - *

- * {@codesnippet com.azure.storage.blob.specialized.BlobServiceSasSignatureValues.generateSasQueryParameters#UserDelegationKey-String} + * Used to initialize parameters for a Shared Access Signature (SAS) for an Azure Blob Storage service. Once all the + * values here are set, use the appropriate SAS generation method on the desired container/blob client to obtain a + * representation of the SAS which can then be applied to a new client using the .sasToken(String) method on the + * desired client builder. * - * @see BlobServiceSasQueryParameters * @see Storage SAS overview * @see Constructing a Service * SAS + * @see Constructing a + * User Delegation SAS */ public final class BlobServiceSasSignatureValues { /** @@ -89,27 +80,48 @@ public final class BlobServiceSasSignatureValues { /** * Creates an object with empty values for all fields. + * @deprecated Please use {@link #BlobServiceSasSignatureValues(String)}, + * {@link #BlobServiceSasSignatureValues(OffsetDateTime, BlobSasPermission)}, or + * {@link #BlobServiceSasSignatureValues(OffsetDateTime, BlobContainerSasPermission)} */ + @Deprecated public BlobServiceSasSignatureValues() { } /** * Creates an object with the specified expiry time and permissions * - * @param expiryTime Time the SAS becomes valid - * @param permissions Permissions granted by the SAS + * @param expiryTime The time after which the SAS will no longer work. + * @param permissions {@link BlobContainerSasPermission} allowed by the SAS. */ - BlobServiceSasSignatureValues(OffsetDateTime expiryTime, String permissions) { + public BlobServiceSasSignatureValues(OffsetDateTime expiryTime, BlobContainerSasPermission permissions) { + StorageImplUtils.assertNotNull("expiryTime", expiryTime); + StorageImplUtils.assertNotNull("permissions", permissions); this.expiryTime = expiryTime; - this.permissions = permissions; + this.permissions = permissions.toString(); } /** - * Creates an object with the specified identifier + * Creates an object with the specified expiry time and permissions * - * @param identifier Identifier for the SAS + * @param expiryTime When the SAS will no longer work + * @param permissions {@link BlobSasPermission} allowed by the SAS + */ + public BlobServiceSasSignatureValues(OffsetDateTime expiryTime, BlobSasPermission permissions) { + StorageImplUtils.assertNotNull("expiryTime", expiryTime); + StorageImplUtils.assertNotNull("permissions", permissions); + this.expiryTime = expiryTime; + this.permissions = permissions.toString(); + } + + /** + * Creates an object with the specified identifier. + * NOTE: Identifier can not be used for a {@link UserDelegationKey} SAS. + * + * @param identifier Name of the access policy */ - BlobServiceSasSignatureValues(String identifier) { + public BlobServiceSasSignatureValues(String identifier) { + StorageImplUtils.assertNotNull("identifier", identifier); this.identifier = identifier; } @@ -129,7 +141,12 @@ public BlobServiceSasSignatureValues() { * @param contentEncoding The content-encoding header for the SAS. * @param contentLanguage The content-language header for the SAS. * @param contentType The content-type header for the SAS. + * @deprecated Please use {@link #BlobServiceSasSignatureValues(String)}, + * {@link #BlobServiceSasSignatureValues(OffsetDateTime, BlobSasPermission)}, or + * {@link #BlobServiceSasSignatureValues(OffsetDateTime, BlobContainerSasPermission)} + * followed by calls to the desired setters. */ + @Deprecated public BlobServiceSasSignatureValues(String version, SasProtocol sasProtocol, OffsetDateTime startTime, OffsetDateTime expiryTime, String permission, SasIpRange sasIpRange, String identifier, String cacheControl, String contentDisposition, String contentEncoding, String contentLanguage, String contentType) { @@ -279,7 +296,10 @@ public BlobServiceSasSignatureValues setSasIpRange(SasIpRange sasIpRange) { * Gets the name of the container the SAS user may access. * * @return The name of the container the SAS user may access. + * @deprecated Container name is now auto-populated by the SAS generation methods provided on the desired + * container/blob client. */ + @Deprecated public String getContainerName() { return containerName; } @@ -289,7 +309,10 @@ public String getContainerName() { * * @param containerName The name of the container. * @return The updated BlobServiceSASSignatureValues object. + * @deprecated Please use the SAS generation methods provided on the desired container/blob client that will + * auto-populate the container name. */ + @Deprecated public BlobServiceSasSignatureValues setContainerName(String containerName) { this.containerName = containerName; return this; @@ -301,7 +324,9 @@ public BlobServiceSasSignatureValues setContainerName(String containerName) { * * @return The decoded name of the blob the SAS user may access. {@code null} or an empty string is returned when a * creating a container SAS. + * @deprecated Blob name is now auto-populated by the SAS generation methods provided on the desired blob client. */ + @Deprecated public String getBlobName() { return blobName; } @@ -311,7 +336,10 @@ public String getBlobName() { * * @param blobName The name of the blob. Use {@code null} or an empty string to create a container SAS. * @return The updated BlobServiceSASSignatureValues object. + * @deprecated Please use the SAS generation methods provided on the desired blob client that will auto-populate the + * blob name. */ + @Deprecated public BlobServiceSasSignatureValues setBlobName(String blobName) { this.blobName = (blobName == null) ? null : Utility.urlDecode(blobName); return this; @@ -319,7 +347,10 @@ public BlobServiceSasSignatureValues setBlobName(String blobName) { /** * @return the specific snapshot the SAS user may access. + * @deprecated Snapshot id is now auto-populated by the SAS generation methods provided on the desired (snapshot) + * blob client. */ + @Deprecated public String getSnapshotId() { return this.snapshotId; } @@ -332,7 +363,10 @@ public String getSnapshotId() { * * @param snapshotId Identifier of the snapshot * @return the updated BlobServiceSASSignatureValues object + * @deprecated Please use the SAS generation methods provided on the desired (snapshot) blob client that will + * auto-populate the snapshot id. */ + @Deprecated public BlobServiceSasSignatureValues setSnapshotId(String snapshotId) { this.snapshotId = snapshotId; if (snapshotId != null && SAS_BLOB_CONSTANT.equals(resource)) { @@ -485,7 +519,10 @@ public BlobServiceSasSignatureValues setContentType(String contentType) { * encoded string, or the UTF-8 charset isn't supported. * @throws IllegalArgumentException if {@link #getPermissions()} contains an invalid character for the SAS resource. * @throws NullPointerException if {@code storageSharedKeyCredentials} is null. + * @deprecated Please use the generateSas(BlobServiceSasSignatureValues) method on the desired container/blob client + * after initializing {@link BlobServiceSasSignatureValues}. */ + @Deprecated public BlobServiceSasQueryParameters generateSasQueryParameters( StorageSharedKeyCredential storageSharedKeyCredentials) { StorageImplUtils.assertNotNull("storageSharedKeyCredentials", storageSharedKeyCredentials); @@ -535,9 +572,12 @@ public BlobServiceSasQueryParameters generateSasQueryParameters( * @throws NullPointerException if {@code delegationKey} or {@code account} is null. * @see * Create a user delegation SAS + * @deprecated Please use the generateUserDelegationSas(BlobServiceSasSignatureValues, UserDelegationKey) method on + * the desired container/blob client after initializing {@link BlobServiceSasSignatureValues}. */ + @Deprecated public BlobServiceSasQueryParameters generateSasQueryParameters(UserDelegationKey delegationKey, - String accountName) { + String accountName) { StorageImplUtils.assertNotNull("delegationKey", delegationKey); StorageImplUtils.assertNotNull("accountName", accountName); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java index e55fb46907f7..6d0ea56a2702 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java @@ -15,6 +15,7 @@ import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollResponse; import com.azure.core.util.polling.PollerFlux; +import com.azure.storage.blob.BlobServiceAsyncClient; import com.azure.storage.blob.BlobServiceVersion; import com.azure.storage.blob.HttpGetterInfo; import com.azure.storage.blob.ProgressReporter; @@ -23,6 +24,7 @@ import com.azure.storage.blob.implementation.models.BlobGetAccountInfoHeaders; import com.azure.storage.blob.implementation.models.BlobGetPropertiesHeaders; import com.azure.storage.blob.implementation.models.BlobStartCopyFromURLHeaders; +import com.azure.storage.blob.implementation.util.BlobSasImplUtil; import com.azure.storage.blob.implementation.util.ModelHelper; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.ArchiveStatus; @@ -41,8 +43,12 @@ import com.azure.storage.blob.models.ParallelTransferOptions; import com.azure.storage.blob.models.RehydratePriority; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.UserDelegationKey; +import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; +import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.Utility; import com.azure.storage.common.implementation.Constants; +import com.azure.storage.common.implementation.SasImplUtils; import com.azure.storage.common.implementation.StorageImplUtils; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -62,6 +68,7 @@ import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.time.Duration; +import java.time.OffsetDateTime; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.Lock; @@ -1384,4 +1391,43 @@ Mono> getAccountInfoWithResponse(Context context) { return new SimpleResponse<>(rb, new StorageAccountInfo(hd.getSkuName(), hd.getAccountKind())); }); } + + /** + * Generates a user delegation SAS for the blob using the specified {@link BlobServiceSasSignatureValues}. + *

See {@link BlobServiceSasSignatureValues} for more information on how to construct a user delegation SAS.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.generateUserDelegationSas#BlobServiceSasSignatureValues-UserDelegationKey} + * + * @param blobServiceSasSignatureValues {@link BlobServiceSasSignatureValues} + * @param userDelegationKey A {@link UserDelegationKey} object used to sign the SAS values. + * @see BlobServiceAsyncClient#getUserDelegationKey(OffsetDateTime, OffsetDateTime) for more information on how to + * get a user delegation key. + * + * @return A {@code String} representing all SAS query parameters. + */ + public String generateUserDelegationSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues, + UserDelegationKey userDelegationKey) { + return new BlobSasImplUtil(blobServiceSasSignatureValues, getContainerName(), getBlobName(), getSnapshotId()) + .generateUserDelegationSas(userDelegationKey, getAccountName()); + } + + /** + * Generates a service SAS for the blob using the specified {@link BlobServiceSasSignatureValues} + * Note : The client must be authenticated via {@link StorageSharedKeyCredential} + *

See {@link BlobServiceSasSignatureValues} for more information on how to construct a service SAS.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.generateSas#BlobServiceSasSignatureValues} + * + * @param blobServiceSasSignatureValues {@link BlobServiceSasSignatureValues} + * + * @return A {@code String} representing all SAS query parameters. + */ + public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues) { + return new BlobSasImplUtil(blobServiceSasSignatureValues, getContainerName(), getBlobName(), getSnapshotId()) + .generateSas(SasImplUtils.extractSharedKeyCredential(getHttpPipeline())); + } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java index f4490492b9ce..bc0df9fcc0c1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobClientBase.java @@ -12,6 +12,7 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.SyncPoller; import com.azure.storage.blob.BlobClient; +import com.azure.storage.blob.BlobServiceClient; import com.azure.storage.blob.models.BlobProperties; import com.azure.storage.blob.BlobServiceVersion; import com.azure.storage.blob.models.AccessTier; @@ -27,6 +28,9 @@ import com.azure.storage.blob.models.ParallelTransferOptions; import com.azure.storage.blob.models.RehydratePriority; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.UserDelegationKey; +import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; +import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.implementation.StorageImplUtils; import reactor.core.Exceptions; import reactor.core.publisher.Mono; @@ -37,6 +41,7 @@ import java.net.URL; import java.nio.file.FileAlreadyExistsException; import java.time.Duration; +import java.time.OffsetDateTime; import java.util.Map; import static com.azure.storage.common.implementation.StorageImplUtils.blockWithOptionalTimeout; @@ -799,4 +804,40 @@ public Response getAccountInfoWithResponse(Duration timeout, return blockWithOptionalTimeout(response, timeout); } + + /** + * Generates a user delegation SAS for the blob using the specified {@link BlobServiceSasSignatureValues}. + *

See {@link BlobServiceSasSignatureValues} for more information on how to construct a user delegation SAS.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.generateUserDelegationSas#BlobServiceSasSignatureValues-UserDelegationKey} + * + * @param blobServiceSasSignatureValues {@link BlobServiceSasSignatureValues} + * @param userDelegationKey A {@link UserDelegationKey} object used to sign the SAS values. + * @see BlobServiceClient#getUserDelegationKey(OffsetDateTime, OffsetDateTime) for more information on how to get a + * user delegation key. + * @return A {@code String} representing all SAS query parameters. + */ + public String generateUserDelegationSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues, + UserDelegationKey userDelegationKey) { + return this.client.generateUserDelegationSas(blobServiceSasSignatureValues, userDelegationKey); + } + + /** + * Generates a service SAS for the blob using the specified {@link BlobServiceSasSignatureValues} + * Note : The client must be authenticated via {@link StorageSharedKeyCredential} + *

See {@link BlobServiceSasSignatureValues} for more information on how to construct a service SAS.

+ * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.generateSas#BlobServiceSasSignatureValues} + * + * @param blobServiceSasSignatureValues {@link BlobServiceSasSignatureValues} + * + * @return A {@code String} representing all SAS query parameters. + */ + public String generateSas(BlobServiceSasSignatureValues blobServiceSasSignatureValues) { + return this.client.generateSas(blobServiceSasSignatureValues); + } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java index 26a0fa3c1399..eb3080f8d894 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java @@ -12,6 +12,7 @@ import com.azure.storage.blob.models.DownloadRetryOptions; import com.azure.storage.blob.models.ParallelTransferOptions; import com.azure.storage.blob.models.RehydratePriority; +import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.blob.specialized.BlobAsyncClientBase; import reactor.core.publisher.Flux; @@ -40,6 +41,7 @@ public class BlobAsyncClientJavaDocCodeSnippets { private int blockSize = 50; private int numBuffers = 2; private String filePath = "filePath"; + private UserDelegationKey userDelegationKey = JavaDocCodeSnippetsHelpers.getUserDelegationKey(); /** * Code snippet for {@link BlobAsyncClient#exists()} @@ -505,5 +507,4 @@ public void uploadFromFile2() { .subscribe(completion -> System.out.println("Upload from file succeeded")); // END: com.azure.storage.blob.BlobAsyncClient.uploadFromFile#String-ParallelTransferOptions-BlobHttpHeaders-Map-AccessTier-BlobRequestConditions } - } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java index 41a89745bf91..8050fdd08d73 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java @@ -15,6 +15,7 @@ import com.azure.storage.blob.models.ParallelTransferOptions; import com.azure.storage.blob.models.RehydratePriority; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.blob.specialized.BlobClientBase; import com.azure.storage.common.implementation.Constants; @@ -44,6 +45,7 @@ public class BlobClientJavaDocCodeSnippets { private String value1 = "val1"; private String value2 = "val2"; private String filePath = "filePath"; + private UserDelegationKey userDelegationKey = JavaDocCodeSnippetsHelpers.getUserDelegationKey(); /** * Code snippets for {@link BlobClient#exists()} diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobContainerAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobContainerAsyncClientJavaDocCodeSnippets.java index adecfd3cf357..5c01f5bb5060 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobContainerAsyncClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobContainerAsyncClientJavaDocCodeSnippets.java @@ -10,6 +10,9 @@ import com.azure.storage.blob.models.BlobSignedIdentifier; import com.azure.storage.blob.models.ListBlobsOptions; import com.azure.storage.blob.models.PublicAccessType; +import com.azure.storage.blob.models.UserDelegationKey; +import com.azure.storage.blob.sas.BlobContainerSasPermission; +import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; import java.time.Duration; import java.time.OffsetDateTime; @@ -29,6 +32,7 @@ public class BlobContainerAsyncClientJavaDocCodeSnippets { private String leaseId = "leaseId"; private String proposedId = "proposedId"; private int leaseDuration = (int) Duration.ofSeconds(30).getSeconds(); + private UserDelegationKey userDelegationKey = JavaDocCodeSnippetsHelpers.getUserDelegationKey(); /** * Code snippet for {@link BlobContainerAsyncClient#getBlobAsyncClient(String)} @@ -343,4 +347,30 @@ public void getContainerName() { System.out.println("The name of the blob is " + containerName); // END: com.azure.storage.blob.BlobContainerAsyncClient.getBlobContainerName } + + /** + * Code snippet for {@link BlobContainerAsyncClient#generateUserDelegationSas(BlobServiceSasSignatureValues, UserDelegationKey)} + * and {@link BlobContainerAsyncClient#generateSas(BlobServiceSasSignatureValues)} + */ + public void generateSas() { + // BEGIN: com.azure.storage.blob.BlobContainerAsyncClient.generateSas#BlobServiceSasSignatureValues + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + BlobContainerSasPermission permission = new BlobContainerSasPermission().setReadPermission(true); + + BlobServiceSasSignatureValues values = new BlobServiceSasSignatureValues(expiryTime, permission) + .setStartTime(OffsetDateTime.now()); + + client.generateSas(values); // Client must be authenticated via StorageSharedKeyCredential + // END: com.azure.storage.blob.BlobContainerAsyncClient.generateSas#BlobServiceSasSignatureValues + + // BEGIN: com.azure.storage.blob.BlobContainerAsyncClient.generateUserDelegationSas#BlobServiceSasSignatureValues-UserDelegationKey + OffsetDateTime myExpiryTime = OffsetDateTime.now().plusDays(1); + BlobContainerSasPermission myPermission = new BlobContainerSasPermission().setReadPermission(true); + + BlobServiceSasSignatureValues myValues = new BlobServiceSasSignatureValues(expiryTime, permission) + .setStartTime(OffsetDateTime.now()); + + client.generateUserDelegationSas(values, userDelegationKey); + // END: com.azure.storage.blob.BlobContainerAsyncClient.generateUserDelegationSas#BlobServiceSasSignatureValues-UserDelegationKey + } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobContainerClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobContainerClientJavaDocCodeSnippets.java index 30dedd456747..0629bc63bf5c 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobContainerClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobContainerClientJavaDocCodeSnippets.java @@ -15,6 +15,9 @@ import com.azure.storage.blob.models.ListBlobsOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.UserDelegationKey; +import com.azure.storage.blob.sas.BlobContainerSasPermission; +import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; import java.time.Duration; import java.time.OffsetDateTime; @@ -32,6 +35,7 @@ public class BlobContainerClientJavaDocCodeSnippets { private String proposedId = "proposedId"; private int leaseDuration = (int) Duration.ofSeconds(30).getSeconds(); private Duration timeout = Duration.ofSeconds(30); + private UserDelegationKey userDelegationKey = JavaDocCodeSnippetsHelpers.getUserDelegationKey(); /** * Code snippet for {@link BlobContainerClient#getBlobClient(String)} @@ -360,4 +364,30 @@ public void getContainerName() { System.out.println("The name of the blob is " + containerName); // END: com.azure.storage.blob.BlobContainerClient.getBlobContainerName } + + /** + * Code snippet for {@link BlobContainerClient#generateUserDelegationSas(BlobServiceSasSignatureValues, UserDelegationKey)} + * and {@link BlobContainerClient#generateSas(BlobServiceSasSignatureValues)} + */ + public void generateSas() { + // BEGIN: com.azure.storage.blob.BlobContainerClient.generateSas#BlobServiceSasSignatureValues + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + BlobContainerSasPermission permission = new BlobContainerSasPermission().setReadPermission(true); + + BlobServiceSasSignatureValues values = new BlobServiceSasSignatureValues(expiryTime, permission) + .setStartTime(OffsetDateTime.now()); + + client.generateSas(values); // Client must be authenticated via StorageSharedKeyCredential + // END: com.azure.storage.blob.BlobContainerClient.generateSas#BlobServiceSasSignatureValues + + // BEGIN: com.azure.storage.blob.BlobContainerClient.generateUserDelegationSas#BlobServiceSasSignatureValues-UserDelegationKey + OffsetDateTime myExpiryTime = OffsetDateTime.now().plusDays(1); + BlobContainerSasPermission myPermission = new BlobContainerSasPermission().setReadPermission(true); + + BlobServiceSasSignatureValues myValues = new BlobServiceSasSignatureValues(expiryTime, permission) + .setStartTime(OffsetDateTime.now()); + + client.generateUserDelegationSas(values, userDelegationKey); + // END: com.azure.storage.blob.BlobContainerClient.generateUserDelegationSas#BlobServiceSasSignatureValues-UserDelegationKey + } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java index c2c2b7167f3a..5ae2897a2e88 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java @@ -11,7 +11,12 @@ import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; +import com.azure.storage.common.sas.AccountSasPermission; +import com.azure.storage.common.sas.AccountSasResourceType; +import com.azure.storage.common.sas.AccountSasService; +import com.azure.storage.common.sas.AccountSasSignatureValues; +import java.time.Duration; import java.time.OffsetDateTime; import java.util.Collections; import java.util.Map; @@ -234,4 +239,24 @@ public void getAccountInfoWithResponse() { response.getValue().getSkuName())); // END: com.azure.storage.blob.BlobServiceAsyncClient.getAccountInfoWithResponse } + + /** + * Code snippet for {@link BlobServiceAsyncClient#generateAccountSas(AccountSasSignatureValues)} + */ + public void generateAccountSas() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.generateAccountSas#AccountSasSignatureValues + AccountSasPermission permissions = new AccountSasPermission() + .setListPermission(true) + .setReadPermission(true); + AccountSasResourceType resourceTypes = new AccountSasResourceType().setContainer(true); + AccountSasService services = new AccountSasService().setBlobAccess(true).setFileAccess(true); + OffsetDateTime expiryTime = OffsetDateTime.now().plus(Duration.ofDays(2)); + + AccountSasSignatureValues sasValues = + new AccountSasSignatureValues(expiryTime, permissions, services, resourceTypes); + + // Client must be authenticated via StorageSharedKeyCredential + String sas = client.generateAccountSas(sasValues); + // END: com.azure.storage.blob.BlobServiceAsyncClient.generateAccountSas#AccountSasSignatureValues + } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java index 5f2b7f135608..bfc83ae426f9 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java @@ -12,6 +12,10 @@ import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.common.sas.AccountSasPermission; +import com.azure.storage.common.sas.AccountSasResourceType; +import com.azure.storage.common.sas.AccountSasService; +import com.azure.storage.common.sas.AccountSasSignatureValues; import java.time.Duration; import java.time.OffsetDateTime; @@ -241,4 +245,24 @@ public void getAccountInfoWithResponse() { StorageAccountInfo accountInfo = client.getAccountInfoWithResponse(timeout, context).getValue(); // END: com.azure.storage.blob.BlobServiceClient.getAccountInfoWithResponse#Duration-Context } + + /** + * Code snippet for {@link BlobServiceClient#generateAccountSas(AccountSasSignatureValues)} + */ + public void generateAccountSas() { + // BEGIN: com.azure.storage.blob.BlobServiceClient.generateAccountSas#AccountSasSignatureValues + AccountSasPermission permissions = new AccountSasPermission() + .setListPermission(true) + .setReadPermission(true); + AccountSasResourceType resourceTypes = new AccountSasResourceType().setContainer(true); + AccountSasService services = new AccountSasService().setBlobAccess(true).setFileAccess(true); + OffsetDateTime expiryTime = OffsetDateTime.now().plus(Duration.ofDays(2)); + + AccountSasSignatureValues sasValues = + new AccountSasSignatureValues(expiryTime, permissions, services, resourceTypes); + + // Client must be authenticated via StorageSharedKeyCredential + String sas = client.generateAccountSas(sasValues); + // END: com.azure.storage.blob.BlobServiceClient.generateAccountSas#AccountSasSignatureValues + } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java index 2523d7b4bcef..04be7ae407b1 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java @@ -3,6 +3,8 @@ package com.azure.storage.blob; +import com.azure.storage.blob.models.UserDelegationKey; + final class JavaDocCodeSnippetsHelpers { static BlobContainerAsyncClient getContainerAsyncClient() { return new BlobContainerClientBuilder().buildAsyncClient(); @@ -27,4 +29,8 @@ static BlobServiceAsyncClient getBlobServiceAsyncClient() { static BlobServiceClient getBlobServiceClient() { return new BlobServiceClientBuilder().buildClient(); } + + static UserDelegationKey getUserDelegationKey() { + return getBlobServiceClient().getUserDelegationKey(null, null); + } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java index 88686e5c7278..9058b8e3cb8a 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java @@ -5,6 +5,7 @@ import com.azure.core.http.RequestConditions; import com.azure.core.util.polling.PollerFlux; +import com.azure.storage.blob.BlobServiceClientBuilder; import com.azure.storage.blob.BlobServiceVersion; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobCopyInfo; @@ -15,6 +16,9 @@ import com.azure.storage.blob.models.DownloadRetryOptions; import com.azure.storage.blob.models.ParallelTransferOptions; import com.azure.storage.blob.models.RehydratePriority; +import com.azure.storage.blob.models.UserDelegationKey; +import com.azure.storage.blob.sas.BlobSasPermission; +import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; import reactor.core.publisher.Mono; import java.io.ByteArrayOutputStream; @@ -36,6 +40,7 @@ public class BlobAsyncClientBaseJavaDocCodeSnippets { private String copyId = "copyId"; private String url = "https://sample.com"; private String file = "file"; + private UserDelegationKey userDelegationKey = new BlobServiceClientBuilder().buildClient().getUserDelegationKey(null, null); /** * Code snippet for {@link BlobAsyncClientBase#exists()} @@ -420,4 +425,30 @@ public void getAccountInfoWithResponseCodeSnippets() { response.getValue().getAccountKind(), response.getValue().getSkuName())); // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.getAccountInfoWithResponse } + + /** + * Code snippet for {@link BlobAsyncClientBase#generateUserDelegationSas(BlobServiceSasSignatureValues, UserDelegationKey)} + * and {@link BlobAsyncClientBase#generateSas(BlobServiceSasSignatureValues)} + */ + public void generateSas() { + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.generateSas#BlobServiceSasSignatureValues + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + BlobSasPermission permission = new BlobSasPermission().setReadPermission(true); + + BlobServiceSasSignatureValues values = new BlobServiceSasSignatureValues(expiryTime, permission) + .setStartTime(OffsetDateTime.now()); + + client.generateSas(values); // Client must be authenticated via StorageSharedKeyCredential + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.generateSas#BlobServiceSasSignatureValues + + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.generateUserDelegationSas#BlobServiceSasSignatureValues-UserDelegationKey + OffsetDateTime myExpiryTime = OffsetDateTime.now().plusDays(1); + BlobSasPermission myPermission = new BlobSasPermission().setReadPermission(true); + + BlobServiceSasSignatureValues myValues = new BlobServiceSasSignatureValues(expiryTime, permission) + .setStartTime(OffsetDateTime.now()); + + client.generateUserDelegationSas(values, userDelegationKey); + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.generateUserDelegationSas#BlobServiceSasSignatureValues-UserDelegationKey + } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobClientBaseJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobClientBaseJavaDocCodeSnippets.java index 7dfa2e03e0c4..2cd4e3c850d8 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobClientBaseJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobClientBaseJavaDocCodeSnippets.java @@ -8,6 +8,7 @@ import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollResponse; import com.azure.core.util.polling.SyncPoller; +import com.azure.storage.blob.BlobServiceClientBuilder; import com.azure.storage.blob.models.BlobProperties; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobCopyInfo; @@ -19,6 +20,9 @@ import com.azure.storage.blob.models.ParallelTransferOptions; import com.azure.storage.blob.models.RehydratePriority; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.UserDelegationKey; +import com.azure.storage.blob.sas.BlobSasPermission; +import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; import com.azure.storage.common.implementation.Constants; import java.io.ByteArrayOutputStream; @@ -44,6 +48,7 @@ public class BlobClientBaseJavaDocCodeSnippets { private String key2 = "key2"; private String value1 = "val1"; private String value2 = "val2"; + private UserDelegationKey userDelegationKey = new BlobServiceClientBuilder().buildClient().getUserDelegationKey(null, null); /** * Code snippets for {@link BlobClientBase#exists()} @@ -375,4 +380,30 @@ public void getAccountInfoWithResponseCodeSnippets() { System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.getAccountKind(), accountInfo.getSkuName()); // END: com.azure.storage.blob.specialized.BlobClientBase.getAccountInfoWithResponse#Duration-Context } + + /** + * Code snippet for {@link BlobClientBase#generateUserDelegationSas(BlobServiceSasSignatureValues, UserDelegationKey)} + * and {@link BlobClientBase#generateSas(BlobServiceSasSignatureValues)} + */ + public void generateSas() { + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.generateSas#BlobServiceSasSignatureValues + OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); + BlobSasPermission permission = new BlobSasPermission().setReadPermission(true); + + BlobServiceSasSignatureValues values = new BlobServiceSasSignatureValues(expiryTime, permission) + .setStartTime(OffsetDateTime.now()); + + client.generateSas(values); // Client must be authenticated via StorageSharedKeyCredential + // END: com.azure.storage.blob.specialized.BlobClientBase.generateSas#BlobServiceSasSignatureValues + + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.generateUserDelegationSas#BlobServiceSasSignatureValues-UserDelegationKey + OffsetDateTime myExpiryTime = OffsetDateTime.now().plusDays(1); + BlobSasPermission myPermission = new BlobSasPermission().setReadPermission(true); + + BlobServiceSasSignatureValues myValues = new BlobServiceSasSignatureValues(expiryTime, permission) + .setStartTime(OffsetDateTime.now()); + + client.generateUserDelegationSas(values, userDelegationKey); + // END: com.azure.storage.blob.specialized.BlobClientBase.generateUserDelegationSas#BlobServiceSasSignatureValues-UserDelegationKey + } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobServiceSasSignatureValuesJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobServiceSasSignatureValuesJavaDocCodeSnippets.java deleted file mode 100644 index 28545a360ab2..000000000000 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobServiceSasSignatureValuesJavaDocCodeSnippets.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob.specialized; - -import com.azure.storage.blob.sas.BlobSasPermission; -import com.azure.storage.blob.models.UserDelegationKey; -import com.azure.storage.blob.sas.BlobServiceSasQueryParameters; -import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; -import com.azure.storage.common.StorageSharedKeyCredential; -import com.azure.storage.common.sas.SasProtocol; - -import java.time.OffsetDateTime; - -/** - * Code snippets for {@link BlobServiceSasSignatureValues}. - */ -public class BlobServiceSasSignatureValuesJavaDocCodeSnippets { - /** - * Generates a blob SAS with {@link StorageSharedKeyCredential} - */ - public void blobSas() { - // BEGIN: com.azure.storage.blob.specialized.BlobServiceSasSignatureValues.generateSasQueryParameters#StorageSharedKeyCredential - BlobSasPermission blobPermission = new BlobSasPermission().setReadPermission(true); - - // We are creating a SAS to a blob because we set both the container name and blob name. - BlobServiceSasSignatureValues builder = new BlobServiceSasSignatureValues() - .setProtocol(SasProtocol.HTTPS_ONLY) // Users MUST use HTTPS (not HTTP). - .setExpiryTime(OffsetDateTime.now().plusDays(2)) - .setContainerName("my-container") - .setBlobName("HelloWorld.txt") - .setPermissions(blobPermission); - - StorageSharedKeyCredential credential = new StorageSharedKeyCredential("account-name", "key"); - BlobServiceSasQueryParameters sasQueryParameters = builder.generateSasQueryParameters(credential); - // END: com.azure.storage.blob.specialized.BlobServiceSasSignatureValues.generateSasQueryParameters#StorageSharedKeyCredential - } - - /** - * Generates a container SAS using {@link UserDelegationKey}. - */ - public void userDelegationKey() { - // BEGIN: com.azure.storage.blob.specialized.BlobServiceSasSignatureValues.generateSasQueryParameters#UserDelegationKey-String - BlobSasPermission blobPermission = new BlobSasPermission() - .setReadPermission(true) - .setWritePermission(true); - - // We are creating a SAS to a container because only container name is set. - BlobServiceSasSignatureValues builder = new BlobServiceSasSignatureValues() - .setProtocol(SasProtocol.HTTPS_ONLY) // Users MUST use HTTPS (not HTTP). - .setExpiryTime(OffsetDateTime.now().plusDays(2)) - .setContainerName("my-container") - .setPermissions(blobPermission); - - // Get a user delegation key after signing in with Azure AD - UserDelegationKey credential = new UserDelegationKey(); - String account = "my-blob-storage-account"; - BlobServiceSasQueryParameters sasQueryParameters = builder.generateSasQueryParameters(credential, account); - // END: com.azure.storage.blob.specialized.BlobServiceSasSignatureValues.generateSasQueryParameters#UserDelegationKey-String - } -} diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/SASTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/SASTest.groovy index cbc2c6d5147a..76ff4005f371 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/SASTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/SASTest.groovy @@ -32,6 +32,8 @@ import java.time.ZoneOffset class SASTest extends APISpec { + // TODO (gapra) : Cleanup SAS Tests + @Unroll def "Blob range"() { expect: diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/SasClientTests.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/SasClientTests.groovy new file mode 100644 index 000000000000..24ed0b81538f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/SasClientTests.groovy @@ -0,0 +1,544 @@ +package com.azure.storage.blob + +import com.azure.storage.blob.implementation.util.BlobSasImplUtil +import com.azure.storage.blob.models.BlobAccessPolicy +import com.azure.storage.blob.models.BlobProperties +import com.azure.storage.blob.models.BlobSignedIdentifier +import com.azure.storage.blob.models.BlobStorageException +import com.azure.storage.blob.models.UserDelegationKey +import com.azure.storage.blob.sas.BlobContainerSasPermission +import com.azure.storage.blob.sas.BlobSasPermission +import com.azure.storage.blob.sas.BlobServiceSasSignatureValues +import com.azure.storage.blob.specialized.BlockBlobClient +import com.azure.storage.blob.specialized.SpecializedBlobClientBuilder +import com.azure.storage.common.implementation.Constants +import com.azure.storage.common.implementation.StorageImplUtils +import com.azure.storage.common.sas.AccountSasPermission +import com.azure.storage.common.sas.AccountSasResourceType +import com.azure.storage.common.sas.AccountSasService +import com.azure.storage.common.sas.AccountSasSignatureValues +import com.azure.storage.common.sas.SasIpRange +import com.azure.storage.common.sas.SasProtocol +import spock.lang.Unroll + +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class SasClientTests extends APISpec { + + BlockBlobClient sasClient + String blobName + + def setup() { + blobName = generateBlobName() + sasClient = getBlobClient(primaryCredential, cc.getBlobContainerUrl(), blobName).getBlockBlobClient() + sasClient.upload(new ByteArrayInputStream(defaultData.array()), defaultDataSize) + } + + def "network test blob sas"() { + setup: + def permissions = new BlobSasPermission() + .setReadPermission(true) + .setWritePermission(true) + .setCreatePermission(true) + .setDeletePermission(true) + .setAddPermission(true) + + def sasValues = generateValues(permissions) + + when: + def sas = sasClient.generateSas(sasValues) + + def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName).getBlockBlobClient() + + def os = new ByteArrayOutputStream() + client.download(os) + def properties = client.getProperties() + + then: + os.toString() == new String(defaultData.array()) + validateSasProperties(properties) + notThrown(BlobStorageException) + } + + def "network test blob snapshot"() { + setup: + + def data = "test".getBytes() + def blobName = generateBlobName() + def bu = getBlobClient(primaryCredential, cc.getBlobContainerUrl(), blobName).getBlockBlobClient() + bu.upload(new ByteArrayInputStream(data), data.length) + def snapshotId = bu.createSnapshot().getSnapshotId() + def snapshotBlob = cc.getBlobClient(blobName, snapshotId).getBlockBlobClient() + + def permissions = new BlobSasPermission() + .setReadPermission(true) + .setWritePermission(true) + .setCreatePermission(true) + .setDeletePermission(true) + .setAddPermission(true) + + def sasValues = generateValues(permissions) + + when: + def sas = snapshotBlob.generateSas(sasValues) + + def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName, snapshotId).getBlockBlobClient() + + def os = new ByteArrayOutputStream() + client.download(os) + def properties = client.getProperties() + + then: + os.toString() == new String(data) + validateSasProperties(properties) + } + + def "serviceSASSignatureValues network test container"() { + setup: + def identifier = new BlobSignedIdentifier() + .setId("0000") + .setAccessPolicy(new BlobAccessPolicy().setPermissions("racwdl") + .setExpiresOn(getUTCNow().plusDays(1))) + cc.setAccessPolicy(null, Arrays.asList(identifier)) + + // Check containerSASPermissions + def permissions = new BlobContainerSasPermission() + .setReadPermission(true) + .setWritePermission(true) + .setListPermission(true) + .setCreatePermission(true) + .setDeletePermission(true) + .setAddPermission(true) + .setListPermission(true) + def expiryTime = getUTCNow().plusDays(1) + + when: + def sasValues = new BlobServiceSasSignatureValues(identifier.getId()) + def sasWithId = cc.generateSas(sasValues) + def client1 = getContainerClient(sasWithId, cc.getBlobContainerUrl()) + client1.listBlobs().iterator().hasNext() + + and: + sasValues = new BlobServiceSasSignatureValues(expiryTime, permissions) + def sasWithPermissions = cc.generateSas(sasValues) + def client2 = getContainerClient(sasWithPermissions, cc.getBlobContainerUrl()) + client2.listBlobs().iterator().hasNext() + + then: + notThrown(BlobStorageException) + } + + def "network test blob user delegation"() { + setup: + def permissions = new BlobSasPermission() + .setReadPermission(true) + .setWritePermission(true) + .setCreatePermission(true) + .setDeletePermission(true) + .setAddPermission(true) + + def sasValues = generateValues(permissions) + + when: + def sas = sasClient.generateUserDelegationSas(sasValues, getUserDelegationInfo()) + + def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName).getBlockBlobClient() + + def os = new ByteArrayOutputStream() + client.download(os) + def properties = client.getProperties() + + then: + os.toString() == new String(defaultData.array()) + validateSasProperties(properties) + notThrown(BlobStorageException) + } + + def "BlobServiceSAS network test blob snapshot"() { + setup: + def snapshotBlob = new SpecializedBlobClientBuilder().blobClient(sasClient.createSnapshot()).buildBlockBlobClient() + def snapshotId = snapshotBlob.getSnapshotId() + def permissions = new BlobSasPermission() + .setReadPermission(true) + .setWritePermission(true) + .setCreatePermission(true) + .setDeletePermission(true) + .setAddPermission(true) + def sasValues = generateValues(permissions) + def sas = snapshotBlob.generateSas(sasValues) + + when: + // base blob with snapshot SAS + def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName).getAppendBlobClient() + client.download(new ByteArrayOutputStream()) + + then: + // snapshot-level SAS shouldn't be able to access base blob + thrown(BlobStorageException) + + when: + // blob snapshot with snapshot SAS + def snapClient = getBlobClient(sas, cc.getBlobContainerUrl(), blobName, snapshotId).getAppendBlobClient() + + def os = new ByteArrayOutputStream() + snapClient.download(os) + + def properties = snapClient.getProperties() + + then: + notThrown(BlobStorageException) + os.toByteArray() == defaultData.array() + + then: + validateSasProperties(properties) + } + + def "network test blob snapshot user delegation"() { + setup: + def snapshotBlob = new SpecializedBlobClientBuilder().blobClient(sasClient.createSnapshot()).buildBlockBlobClient() + def snapshotId = snapshotBlob.getSnapshotId() + + def permissions = new BlobSasPermission() + .setReadPermission(true) + .setWritePermission(true) + .setCreatePermission(true) + .setDeletePermission(true) + .setAddPermission(true) + def sasValues = generateValues(permissions) + def sas = snapshotBlob.generateUserDelegationSas(sasValues, getUserDelegationInfo()) + + when: + // base blob with snapshot SAS + def client1 = getBlobClient(sas, cc.getBlobContainerUrl(), blobName).getBlockBlobClient() + client1.download(new ByteArrayOutputStream()) + + then: + // snapshot-level SAS shouldn't be able to access base blob + thrown(BlobStorageException) + + when: + // blob snapshot with snapshot SAS + def client2 = getBlobClient(sas, cc.getBlobContainerUrl(), blobName, snapshotId).getBlockBlobClient() + def os = new ByteArrayOutputStream() + client2.download(os) + + def properties = client2.getProperties() + + then: + notThrown(BlobStorageException) + os.toString() == new String(defaultData.array()) + validateSasProperties(properties) + } + + def "network test container user delegation"() { + setup: + def permissions = new BlobContainerSasPermission() + .setReadPermission(true) + .setWritePermission(true) + .setCreatePermission(true) + .setDeletePermission(true) + .setAddPermission(true) + .setListPermission(true) + def expiryTime = getUTCNow().plusDays(1) + + when: + def sasValues = new BlobServiceSasSignatureValues(expiryTime, permissions) + def sasWithPermissions = cc.generateUserDelegationSas(sasValues, getUserDelegationInfo()) + + def client = getContainerClient(sasWithPermissions, cc.getBlobContainerUrl()) + client.listBlobs().iterator().hasNext() + + then: + notThrown(BlobStorageException) + } + + def "accountSAS network test blob read"() { + setup: + def service = new AccountSasService() + .setBlobAccess(true) + def resourceType = new AccountSasResourceType() + .setContainer(true) + .setService(true) + .setObject(true) + def permissions = new AccountSasPermission() + .setReadPermission(true) + def expiryTime = getUTCNow().plusDays(1) + + when: + def sasValues = new AccountSasSignatureValues(expiryTime, permissions, service, resourceType) + def sas = primaryBlobServiceClient.generateAccountSas(sasValues) + def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName).getBlockBlobClient() + def os = new ByteArrayOutputStream() + client.download(os) + + then: + os.toString() == new String(defaultData.array()) + } + + def "accountSAS network test blob delete fails new API"() { + setup: + def service = new AccountSasService() + .setBlobAccess(true) + def resourceType = new AccountSasResourceType() + .setContainer(true) + .setService(true) + .setObject(true) + def permissions = new AccountSasPermission() + .setReadPermission(true) + def expiryTime = getUTCNow().plusDays(1) + + when: + def sasValues = new AccountSasSignatureValues(expiryTime, permissions, service, resourceType) + def sas = primaryBlobServiceClient.generateAccountSas(sasValues) + def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName).getBlockBlobClient() + client.delete() + + then: + thrown(BlobStorageException) + } + + def "accountSAS network create container fails"() { + setup: + def service = new AccountSasService() + .setBlobAccess(true) + def resourceType = new AccountSasResourceType() + .setContainer(true) + .setService(true) + .setObject(true) + def permissions = new AccountSasPermission() + .setReadPermission(true) + .setCreatePermission(false) + def expiryTime = getUTCNow().plusDays(1) + + when: + def sasValues = new AccountSasSignatureValues(expiryTime, permissions, service, resourceType) + def sas = primaryBlobServiceClient.generateAccountSas(sasValues) + def sc = getServiceClient(sas, primaryBlobServiceClient.getAccountUrl()) + sc.createBlobContainer(generateContainerName()) + + then: + thrown(BlobStorageException) + } + + def "accountSAS network create container succeeds"() { + setup: + def service = new AccountSasService() + .setBlobAccess(true) + def resourceType = new AccountSasResourceType() + .setContainer(true) + .setService(true) + .setObject(true) + def permissions = new AccountSasPermission() + .setReadPermission(true) + .setCreatePermission(true) + def expiryTime = getUTCNow().plusDays(1) + + when: + def sasValues = new AccountSasSignatureValues(expiryTime, permissions, service, resourceType) + def sas = primaryBlobServiceClient.generateAccountSas(sasValues) + def sc = getServiceClient(sas, primaryBlobServiceClient.getAccountUrl()) + sc.createBlobContainer(generateContainerName()) + + then: + notThrown(BlobStorageException) + } + + BlobServiceSasSignatureValues generateValues(BlobSasPermission permission) { + return new BlobServiceSasSignatureValues(getUTCNow().plusDays(1), permission) + .setStartTime(getUTCNow().minusDays(1)) + .setProtocol(SasProtocol.HTTPS_HTTP) + .setSasIpRange(new SasIpRange() + .setIpMin("0.0.0.0") + .setIpMax("255.255.255.255")) + .setCacheControl("cache") + .setContentDisposition("disposition") + .setContentEncoding("encoding") + .setContentLanguage("language") + .setContentType("type") + } + + def validateSasProperties(BlobProperties properties) { + boolean ret = true + ret &= properties.getCacheControl() == "cache" + ret &= properties.getContentDisposition() == "disposition" + ret &= properties.getContentEncoding() == "encoding" + ret &= properties.getContentLanguage() == "language" + return ret + } + + UserDelegationKey getUserDelegationInfo() { + def key = getOAuthServiceClient().getUserDelegationKey(getUTCNow().minusDays(1), getUTCNow().plusDays(1)) + def keyOid = getConfigValue(key.getSignedObjectId()) + key.setSignedObjectId(keyOid) + def keyTid = getConfigValue(key.getSignedTenantId()) + key.setSignedTenantId(keyTid) + return key + } + + /* Blob SAS Impl Util Tests */ + def "ensure state version"() { + when: + BlobSasImplUtil implUtil = new BlobSasImplUtil(new BlobServiceSasSignatureValues("id"), "container") + implUtil.version = null + implUtil.ensureState() + + then: + implUtil.version // Version is set + implUtil.resource == "c" // Default resource is container + !implUtil.permissions // Identifier was used so permissions is null + } + + def "ensure state illegal argument"() { + when: + BlobSasImplUtil implUtil = new BlobSasImplUtil(new BlobServiceSasSignatureValues(), null) + + implUtil.ensureState() + + then: + thrown(IllegalStateException) + } + + @Unroll + def "ensure state resource and permission"() { + setup: + def expiryTime = OffsetDateTime.now().plusDays(1) + + expect: + BlobSasImplUtil implUtil = new BlobSasImplUtil(new BlobServiceSasSignatureValues(expiryTime, permission), container, blob, snapshot) + implUtil.ensureState() + implUtil.resource == resource + implUtil.permissions == permissionString + + where: + container | blob | snapshot | permission || resource | permissionString + "container" | null | null | new BlobContainerSasPermission().setReadPermission(true).setListPermission(true) || "c" | "rl" + "container" | "blob" | null | new BlobSasPermission().setReadPermission(true) || "b" | "r" + "container" | "blob" | "snapshot" | new BlobSasPermission().setReadPermission(true) || "bs" | "r" + } + + /* + This test will ensure that each field gets placed into the proper location within the string to sign and that null + values are handled correctly. We will validate the whole SAS with service calls as well as correct serialization of + individual parts later. + */ + + @Unroll + def "blob sas impl util string to sign"() { + when: + def e = OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) + def p = new BlobSasPermission() + p.setReadPermission(true) + def v = new BlobServiceSasSignatureValues(e, p) + + def expected = String.format(expectedStringToSign, primaryCredential.getAccountName()) + + v.setStartTime(startTime) + + if (ipRange != null) { + def ipR = new SasIpRange() + ipR.setIpMin("ip") + v.setSasIpRange(ipR) + } + v.setIdentifier(identifier) + .setProtocol(protocol) + .setCacheControl(cacheControl) + .setContentDisposition(disposition) + .setContentEncoding(encoding) + .setContentLanguage(language) + .setContentType(type) + + def implUtil = new BlobSasImplUtil(v, "containerName", "blobName", snapId) + + def sasToken = implUtil.generateSas(primaryCredential) + + def token = BlobUrlParts.parse(cc.getBlobContainerUrl() + "?" + sasToken).getSasQueryParameters() + + then: + token.getSignature() == primaryCredential.computeHmac256(expected) + + /* + We don't test the blob or containerName properties because canonicalized resource is always added as at least + /blob/accountName. We test canonicalization of resources later. Again, this is not to test a fully functional + sas but the construction of the string to sign. + Signed resource is tested elsewhere, as we work some minor magic in choosing which value to use. + */ + where: + startTime | identifier | ipRange | protocol | snapId | cacheControl | disposition | encoding | language | type || expectedStringToSign + OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | null | null | null | null | null | null | null | null | null || "r\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | "id" | null | null | null | null | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\nid\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | new SasIpRange() | null | null | null | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\nip\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | SasProtocol.HTTPS_ONLY | null | null | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n" + SasProtocol.HTTPS_ONLY + "\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | "snapId" | null | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\nsnapId\n\n\n\n\n" + null | null | null | null | null | "control" | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\ncontrol\n\n\n\n" + null | null | null | null | null | null | "disposition" | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\ndisposition\n\n\n" + null | null | null | null | null | null | null | "encoding" | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\nencoding\n\n" + null | null | null | null | null | null | null | null | "language" | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\nlanguage\n" + null | null | null | null | null | null | null | null | null | "type" || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\ntype" + } + + @Unroll + def "blob sas impl util string to sign user delegation key"() { + when: + def e = OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) + def p = new BlobSasPermission() + p.setReadPermission(true) + def v = new BlobServiceSasSignatureValues(e, p) + + def expected = String.format(expectedStringToSign, primaryCredential.getAccountName()) + + v.setStartTime(startTime) + + if (ipRange != null) { + def ipR = new SasIpRange() + ipR.setIpMin("ip") + v.setSasIpRange(ipR) + } + v.setProtocol(protocol) + .setCacheControl(cacheControl) + .setContentDisposition(disposition) + .setContentEncoding(encoding) + .setContentLanguage(language) + .setContentType(type) + def key = new UserDelegationKey() + .setSignedObjectId(keyOid) + .setSignedTenantId(keyTid) + .setSignedStart(keyStart) + .setSignedExpiry(keyExpiry) + .setSignedService(keyService) + .setSignedVersion(keyVersion) + .setValue(keyValue) + + def implUtil = new BlobSasImplUtil(v, "containerName", "blobName", snapId) + + def sasToken = implUtil.generateUserDelegationSas(key, primaryCredential.getAccountName()) + + def token = BlobUrlParts.parse(cc.getBlobContainerUrl() + "?" + sasToken).getSasQueryParameters() + + then: + token.getSignature() == StorageImplUtils.computeHMac256(key.getValue(), expected) + + /* + We test string to sign functionality directly related to user delegation sas specific parameters + */ + where: + startTime | keyOid | keyTid | keyStart | keyExpiry | keyService | keyVersion | keyValue | ipRange | protocol | snapId | cacheControl | disposition | encoding | language | type || expectedStringToSign + OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | "11111111-1111-1111-1111-111111111111" | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n11111111-1111-1111-1111-111111111111\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | "22222222-2222-2222-2222-222222222222" | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n22222222-2222-2222-2222-222222222222\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | OffsetDateTime.of(LocalDateTime.of(2018, 1, 1, 0, 0), ZoneOffset.UTC) | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n2018-01-01T00:00:00Z\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | OffsetDateTime.of(LocalDateTime.of(2018, 1, 1, 0, 0), ZoneOffset.UTC) | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n2018-01-01T00:00:00Z\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | null | "b" | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n\nb\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | null | null | "2018-06-17" | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n\n\n2018-06-17\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | new SasIpRange() | null | null | null | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n\n\n\nip\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | SasProtocol.HTTPS_ONLY | null | null | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n" + SasProtocol.HTTPS_ONLY + "\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | "snapId" | null | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\nsnapId\n\n\n\n\n" + null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | "control" | null | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\ncontrol\n\n\n\n" + null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | "disposition" | null | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\ndisposition\n\n\n" + null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | "encoding" | null | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\nencoding\n\n" + null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | "language" | null || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\nlanguage\n" + null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | "type" || "r\n\n" + Constants.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\ntype" + } + +} diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsaccountsasnetworkcreatecontainerfails.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsaccountsasnetworkcreatecontainerfails.json new file mode 100644 index 000000000000..a35e56dfb3ed --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsaccountsasnetworkcreatecontainerfails.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails076243fee1aaef?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "dd3aee52-1d32-43b0-9137-0f79d7297a17" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3EA2B5A4", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d921ddbf-401e-0028-45b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:34 GMT", + "x-ms-client-request-id" : "dd3aee52-1d32-43b0-9137-0f79d7297a17" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails076243fee1aaef/javablobaccountsasnetworkcreatecontainerfails1002608965aa", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "cc7772d1-e7d2-49ef-9254-0371879be922", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3EB0D38D", + "Content-Length" : "0", + "x-ms-request-id" : "329a251a-a01e-0020-07b3-a3e99c000000", + "x-ms-client-request-id" : "cc7772d1-e7d2-49ef-9254-0371879be922" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails235600aea25610?restype=container&sv=2019-02-02&ss=b&srt=sco&se=2019-11-26T17%3A09%3A34Z&sp=r&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "3f204df6-d2f2-491b-9a41-24a66eab3fe8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthorizationPermissionMismatch", + "retry-after" : "0", + "Content-Length" : "279", + "StatusCode" : "403", + "x-ms-request-id" : "d921ddc4-401e-0028-48b3-a3f393000000", + "Body" : "AuthorizationPermissionMismatchThis request is not authorized to perform this operation using this permission.\nRequestId:d921ddc4-401e-0028-48b3-a3f393000000\nTime:2019-11-25T17:09:34.6217728Z", + "Date" : "Mon, 25 Nov 2019 17:09:34 GMT", + "x-ms-client-request-id" : "3f204df6-d2f2-491b-9a41-24a66eab3fe8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcaccountsasnetworkcreatecontainerfails&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "808c8d94-4616-4c63-9898-5795bf3ddbba" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a251d-a01e-0020-0ab3-a3e99c000000", + "Body" : "jtcaccountsasnetworkcreatecontainerfailsjtcaccountsasnetworkcreatecontainerfails076243fee1aaefMon, 25 Nov 2019 17:09:34 GMT\"0x8D771CA3EA2B5A4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:34 GMT", + "x-ms-client-request-id" : "808c8d94-4616-4c63-9898-5795bf3ddbba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails076243fee1aaef?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "c4e4157d-59c4-4369-aa1a-ffb637d2767d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921ddc7-401e-0028-4bb3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:34 GMT", + "x-ms-client-request-id" : "c4e4157d-59c4-4369-aa1a-ffb637d2767d" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworkcreatecontainerfails076243fee1aaef", "javablobaccountsasnetworkcreatecontainerfails1002608965aa", "2019-11-25T17:09:34.510036300Z", "jtcaccountsasnetworkcreatecontainerfails235600aea25610" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsaccountsasnetworkcreatecontainersucceeds.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsaccountsasnetworkcreatecontainersucceeds.json new file mode 100644 index 000000000000..003ce4409b93 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsaccountsasnetworkcreatecontainersucceeds.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds08444578c06ff?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "77246998-6b0e-4986-85f3-f0684dbd069b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3EE6122B", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2522-a01e-0020-0fb3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:34 GMT", + "x-ms-client-request-id" : "77246998-6b0e-4986-85f3-f0684dbd069b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds08444578c06ff/javablobaccountsasnetworkcreatecontainersucceeds16289375e8", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "f8618e85-6c37-4b53-9a30-3ee8280a26fc", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3EF44547", + "Content-Length" : "0", + "x-ms-request-id" : "d921ddcb-401e-0028-4eb3-a3f393000000", + "x-ms-client-request-id" : "f8618e85-6c37-4b53-9a30-3ee8280a26fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds2242025117420?restype=container&sv=2019-02-02&ss=b&srt=sco&se=2019-11-26T17%3A09%3A34Z&sp=rc&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "76b73494-3c02-4ca4-bc2f-52cf4b4f9dbf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3F025210", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2528-a01e-0020-14b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:34 GMT", + "x-ms-client-request-id" : "76b73494-3c02-4ca4-bc2f-52cf4b4f9dbf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcaccountsasnetworkcreatecontainersucceeds&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "7e3e052d-8f57-49ac-8f63-6a2d01247d3b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d921ddd1-401e-0028-54b3-a3f393000000", + "Body" : "jtcaccountsasnetworkcreatecontainersucceedsjtcaccountsasnetworkcreatecontainersucceeds08444578c06ffMon, 25 Nov 2019 17:09:34 GMT\"0x8D771CA3EE6122B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcaccountsasnetworkcreatecontainersucceeds2242025117420Mon, 25 Nov 2019 17:09:35 GMT\"0x8D771CA3F025210\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:35 GMT", + "x-ms-client-request-id" : "7e3e052d-8f57-49ac-8f63-6a2d01247d3b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds08444578c06ff?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "6a3d1e04-2692-41f3-85d6-04421cde12a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "329a252a-a01e-0020-15b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:35 GMT", + "x-ms-client-request-id" : "6a3d1e04-2692-41f3-85d6-04421cde12a8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds2242025117420?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "05e17388-cedb-4081-a9b9-d687fe0183de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921ddd7-401e-0028-5ab3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:35 GMT", + "x-ms-client-request-id" : "05e17388-cedb-4081-a9b9-d687fe0183de" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworkcreatecontainersucceeds08444578c06ff", "javablobaccountsasnetworkcreatecontainersucceeds16289375e8", "2019-11-25T17:09:34.952438Z", "jtcaccountsasnetworkcreatecontainersucceeds2242025117420" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsaccountsasnetworktestblobdeletefailsnewapi.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsaccountsasnetworktestblobdeletefailsnewapi.json new file mode 100644 index 000000000000..4c4def91eaa5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsaccountsasnetworktestblobdeletefailsnewapi.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefailsnewapi07881604ae85?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "d247e5f8-80a0-4346-959d-0bf55f510aeb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3E56F596", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2506-a01e-0020-7cb3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:33 GMT", + "x-ms-client-request-id" : "d247e5f8-80a0-4346-959d-0bf55f510aeb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefailsnewapi07881604ae85/javablobaccountsasnetworktestblobdeletefailsnewapi191830c11", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "84d33a34-3955-43d8-bbfb-d95eed75c78f", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3E64885F", + "Content-Length" : "0", + "x-ms-request-id" : "d921ddad-401e-0028-36b3-a3f393000000", + "x-ms-client-request-id" : "84d33a34-3955-43d8-bbfb-d95eed75c78f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefailsnewapi07881604ae85/javablobaccountsasnetworktestblobdeletefailsnewapi191830c11?sv=2019-02-02&ss=b&srt=sco&se=2019-11-26T17%3A09%3A34Z&sp=r&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "60e78f3e-ae7f-4dbf-a828-dc7ada190c5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthorizationPermissionMismatch", + "retry-after" : "0", + "Content-Length" : "279", + "StatusCode" : "403", + "x-ms-request-id" : "329a250c-a01e-0020-80b3-a3e99c000000", + "Body" : "AuthorizationPermissionMismatchThis request is not authorized to perform this operation using this permission.\nRequestId:329a250c-a01e-0020-80b3-a3e99c000000\nTime:2019-11-25T17:09:34.1956005Z", + "Date" : "Mon, 25 Nov 2019 17:09:34 GMT", + "x-ms-client-request-id" : "60e78f3e-ae7f-4dbf-a828-dc7ada190c5c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcaccountsasnetworktestblobdeletefailsnewapi&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "e3649be3-d6be-4fb4-abe3-fdb6431e3515" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d921ddb6-401e-0028-3db3-a3f393000000", + "Body" : "jtcaccountsasnetworktestblobdeletefailsnewapijtcaccountsasnetworktestblobdeletefailsnewapi07881604ae85Mon, 25 Nov 2019 17:09:33 GMT\"0x8D771CA3E56F596\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:34 GMT", + "x-ms-client-request-id" : "e3649be3-d6be-4fb4-abe3-fdb6431e3515", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefailsnewapi07881604ae85?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "f0c3d472-dd66-4feb-ac43-930418ed5eed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "329a2513-a01e-0020-04b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:34 GMT", + "x-ms-client-request-id" : "f0c3d472-dd66-4feb-ac43-930418ed5eed" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworktestblobdeletefailsnewapi07881604ae85", "javablobaccountsasnetworktestblobdeletefailsnewapi191830c11", "2019-11-25T17:09:34.007531800Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsaccountsasnetworktestblobread.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsaccountsasnetworktestblobread.json new file mode 100644 index 000000000000..c209702e4218 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsaccountsasnetworktestblobread.json @@ -0,0 +1,120 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworktestblobread063965c8d0e1aec29b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "8cfbc713-53dc-45e8-8db8-4878c76a593c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3E14CD79", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d921dd90-401e-0028-1eb3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:33 GMT", + "x-ms-client-request-id" : "8cfbc713-53dc-45e8-8db8-4878c76a593c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworktestblobread063965c8d0e1aec29b/javablobaccountsasnetworktestblobread1912206cb7fd2946", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "798df3d4-4416-4efb-b8c0-3ab5aa60467e", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3E22EB68", + "Content-Length" : "0", + "x-ms-request-id" : "329a2502-a01e-0020-79b3-a3e99c000000", + "x-ms-client-request-id" : "798df3d4-4416-4efb-b8c0-3ab5aa60467e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworktestblobread063965c8d0e1aec29b/javablobaccountsasnetworktestblobread1912206cb7fd2946?sv=2019-02-02&ss=b&srt=sco&se=2019-11-26T17%3A09%3A33Z&sp=r&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "20f4b810-052f-48f1-80e8-4531b3eb7375" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 25 Nov 2019 17:09:33 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "0x8D771CA3E22EB68", + "x-ms-creation-time" : "Mon, 25 Nov 2019 17:09:33 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d921dd9e-401e-0028-29b3-a3f393000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "20f4b810-052f-48f1-80e8-4531b3eb7375", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcaccountsasnetworktestblobread&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "d3c129ae-3d86-4b57-b750-96981916402e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2504-a01e-0020-7bb3-a3e99c000000", + "Body" : "jtcaccountsasnetworktestblobreadjtcaccountsasnetworktestblobread063965c8d0e1aec29bMon, 25 Nov 2019 17:09:33 GMT\"0x8D771CA3E14CD79\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:33 GMT", + "x-ms-client-request-id" : "d3c129ae-3d86-4b57-b750-96981916402e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcaccountsasnetworktestblobread063965c8d0e1aec29b?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "d1f2bbeb-e588-4ee8-8fd0-cc9885d72512" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921dda6-401e-0028-2fb3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:33 GMT", + "x-ms-client-request-id" : "d1f2bbeb-e588-4ee8-8fd0-cc9885d72512" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworktestblobread063965c8d0e1aec29b", "javablobaccountsasnetworktestblobread1912206cb7fd2946", "2019-11-25T17:09:33.582213300Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[0].json new file mode 100644 index 000000000000..9a2eaa5dba28 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[0].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign0463058d41c166e0034?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "61dfa141-f23b-4437-ac70-5172049e4ccb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA40468D53", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a255d-a01e-0020-3bb3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:36 GMT", + "x-ms-client-request-id" : "61dfa141-f23b-4437-ac70-5172049e4ccb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign0463058d41c166e0034/javablobblobsasimplutilstringtosign186708b2d0527e4f0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "901cdf90-3451-4259-9830-0ac54ca1e0d5", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA4053D554", + "Content-Length" : "0", + "x-ms-request-id" : "d921de09-401e-0028-09b3-a3f393000000", + "x-ms-client-request-id" : "901cdf90-3451-4259-9830-0ac54ca1e0d5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "90312fee-d521-457f-ae7d-357b439f04ea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2569-a01e-0020-46b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignjtcblobsasimplutilstringtosign0463058d41c166e0034Mon, 25 Nov 2019 17:09:37 GMT\"0x8D771CA40468D53\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:37 GMT", + "x-ms-client-request-id" : "90312fee-d521-457f-ae7d-357b439f04ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign0463058d41c166e0034?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "006d331b-7103-4afd-842c-28ac24d46cda" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de13-401e-0028-13b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:37 GMT", + "x-ms-client-request-id" : "006d331b-7103-4afd-842c-28ac24d46cda" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosign0463058d41c166e0034", "javablobblobsasimplutilstringtosign186708b2d0527e4f0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[1].json new file mode 100644 index 000000000000..2725ca07b74a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[1].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign087850670b2ec7202b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "d4dcca0c-a0bb-4090-bf24-a72c9f65272b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA4080965B", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2570-a01e-0020-4cb3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:37 GMT", + "x-ms-client-request-id" : "d4dcca0c-a0bb-4090-bf24-a72c9f65272b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign087850670b2ec7202b4/javablobblobsasimplutilstringtosign18797451d18f06bd1", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "ab3a11d6-a62d-4e51-91c2-e669874c4bd5", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA408DD165", + "Content-Length" : "0", + "x-ms-request-id" : "d921de17-401e-0028-17b3-a3f393000000", + "x-ms-client-request-id" : "ab3a11d6-a62d-4e51-91c2-e669874c4bd5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "53fda710-7497-41f6-aad9-755c537bf9a2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2575-a01e-0020-4fb3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignjtcblobsasimplutilstringtosign087850670b2ec7202b4Mon, 25 Nov 2019 17:09:37 GMT\"0x8D771CA4080965B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:37 GMT", + "x-ms-client-request-id" : "53fda710-7497-41f6-aad9-755c537bf9a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign087850670b2ec7202b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "b1de0e8d-10ce-4a99-af9e-6432a68ea6dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de18-401e-0028-18b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:37 GMT", + "x-ms-client-request-id" : "b1de0e8d-10ce-4a99-af9e-6432a68ea6dc" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosign087850670b2ec7202b4", "javablobblobsasimplutilstringtosign18797451d18f06bd1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[2].json new file mode 100644 index 000000000000..a63171b0f9b8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[2].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign090609bcb7101a2f174?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "e1939d0b-5d22-40a4-a599-7216fdd53d9d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA40B59543", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a257c-a01e-0020-56b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:37 GMT", + "x-ms-client-request-id" : "e1939d0b-5d22-40a4-a599-7216fdd53d9d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign090609bcb7101a2f174/javablobblobsasimplutilstringtosign186054183160ba113", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "fd98bf01-0f60-4d46-abff-417b8fddbdb8", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA40C25186", + "Content-Length" : "0", + "x-ms-request-id" : "d921de19-401e-0028-19b3-a3f393000000", + "x-ms-client-request-id" : "fd98bf01-0f60-4d46-abff-417b8fddbdb8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "19dec871-5786-4743-aad8-d186afb2930b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a257f-a01e-0020-58b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignjtcblobsasimplutilstringtosign090609bcb7101a2f174Mon, 25 Nov 2019 17:09:37 GMT\"0x8D771CA40B59543\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:37 GMT", + "x-ms-client-request-id" : "19dec871-5786-4743-aad8-d186afb2930b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign090609bcb7101a2f174?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "469bab9d-867d-4b78-9216-55f0409725e2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de1a-401e-0028-1ab3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:37 GMT", + "x-ms-client-request-id" : "469bab9d-867d-4b78-9216-55f0409725e2" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosign090609bcb7101a2f174", "javablobblobsasimplutilstringtosign186054183160ba113" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[3].json new file mode 100644 index 000000000000..4eee63f43ba5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[3].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign0267443cd2712355c94?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "345fef6c-077f-4924-bcdc-f55ca7654777" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA40EA1F07", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2588-a01e-0020-61b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:37 GMT", + "x-ms-client-request-id" : "345fef6c-077f-4924-bcdc-f55ca7654777" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign0267443cd2712355c94/javablobblobsasimplutilstringtosign111531dfa94dbd346", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "7bcb687e-ef12-4367-badc-791e4b59ea3b", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA40F6F2E2", + "Content-Length" : "0", + "x-ms-request-id" : "d921de26-401e-0028-22b3-a3f393000000", + "x-ms-client-request-id" : "7bcb687e-ef12-4367-badc-791e4b59ea3b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "e8441d22-bf5d-4bba-a736-f38a56f0fab2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a25ac-a01e-0020-03b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignjtcblobsasimplutilstringtosign0267443cd2712355c94Mon, 25 Nov 2019 17:09:38 GMT\"0x8D771CA40EA1F07\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:38 GMT", + "x-ms-client-request-id" : "e8441d22-bf5d-4bba-a736-f38a56f0fab2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign0267443cd2712355c94?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "522bde73-b604-4edc-911b-7ee53612c2c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de2a-401e-0028-26b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:38 GMT", + "x-ms-client-request-id" : "522bde73-b604-4edc-911b-7ee53612c2c4" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosign0267443cd2712355c94", "javablobblobsasimplutilstringtosign111531dfa94dbd346" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[4].json new file mode 100644 index 000000000000..3c9c696f45b9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[4].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign0515273d0eef27af664?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "3379ddb5-bb2f-4a21-a7a2-ced8d9a8fff5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA411EA8AB", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a25b3-a01e-0020-08b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:38 GMT", + "x-ms-client-request-id" : "3379ddb5-bb2f-4a21-a7a2-ced8d9a8fff5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign0515273d0eef27af664/javablobblobsasimplutilstringtosign1762500bbee9f7129", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "dbe1ea3e-ea54-48c7-90e4-4cf8f569dbf5", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA412B4A33", + "Content-Length" : "0", + "x-ms-request-id" : "d921de30-401e-0028-2cb3-a3f393000000", + "x-ms-client-request-id" : "dbe1ea3e-ea54-48c7-90e4-4cf8f569dbf5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "09a59b74-9043-47d9-9dd9-155b45ff11ef" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a25b5-a01e-0020-09b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignjtcblobsasimplutilstringtosign0515273d0eef27af664Mon, 25 Nov 2019 17:09:38 GMT\"0x8D771CA411EA8AB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:38 GMT", + "x-ms-client-request-id" : "09a59b74-9043-47d9-9dd9-155b45ff11ef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign0515273d0eef27af664?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "c39ffdf7-d6eb-47ed-b75f-f595a39e9bc2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de34-401e-0028-30b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:38 GMT", + "x-ms-client-request-id" : "c39ffdf7-d6eb-47ed-b75f-f595a39e9bc2" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosign0515273d0eef27af664", "javablobblobsasimplutilstringtosign1762500bbee9f7129" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[5].json new file mode 100644 index 000000000000..bb973749770d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[5].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign027365656db45c9ed74?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "8554f3f2-052f-4270-b0e7-01673bbf6bab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA41530C84", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a25b7-a01e-0020-0ab3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:38 GMT", + "x-ms-client-request-id" : "8554f3f2-052f-4270-b0e7-01673bbf6bab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign027365656db45c9ed74/javablobblobsasimplutilstringtosign17271941f335d5f26", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "4c8b68be-9f0b-42f9-b400-d9ff8a6b516d", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA415FC6DA", + "Content-Length" : "0", + "x-ms-request-id" : "d921de3c-401e-0028-37b3-a3f393000000", + "x-ms-client-request-id" : "4c8b68be-9f0b-42f9-b400-d9ff8a6b516d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "78033a9c-4e0d-448b-ace3-c8d355647164" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a25ba-a01e-0020-0cb3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignjtcblobsasimplutilstringtosign027365656db45c9ed74Mon, 25 Nov 2019 17:09:38 GMT\"0x8D771CA41530C84\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:38 GMT", + "x-ms-client-request-id" : "78033a9c-4e0d-448b-ace3-c8d355647164", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign027365656db45c9ed74?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "4105900b-8bed-4e3f-a580-13c53bdbd73a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de43-401e-0028-3eb3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:38 GMT", + "x-ms-client-request-id" : "4105900b-8bed-4e3f-a580-13c53bdbd73a" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosign027365656db45c9ed74", "javablobblobsasimplutilstringtosign17271941f335d5f26" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[6].json new file mode 100644 index 000000000000..edc3197162a6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[6].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign091866176b5675be3b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "810e7fbb-cf52-4f2e-b210-193bf76e5d43" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA41865C1E", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a25c1-a01e-0020-13b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:39 GMT", + "x-ms-client-request-id" : "810e7fbb-cf52-4f2e-b210-193bf76e5d43" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign091866176b5675be3b4/javablobblobsasimplutilstringtosign137927f07f39a8200", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "812838a6-3bbd-4a98-857f-7f69848b9d97", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA41930C1F", + "Content-Length" : "0", + "x-ms-request-id" : "d921de53-401e-0028-49b3-a3f393000000", + "x-ms-client-request-id" : "812838a6-3bbd-4a98-857f-7f69848b9d97" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "b2b5cce7-a364-4cee-a4cc-fea4c7a0f430" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a25c4-a01e-0020-15b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignjtcblobsasimplutilstringtosign091866176b5675be3b4Mon, 25 Nov 2019 17:09:39 GMT\"0x8D771CA41865C1E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:39 GMT", + "x-ms-client-request-id" : "b2b5cce7-a364-4cee-a4cc-fea4c7a0f430", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign091866176b5675be3b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "9864f68d-f933-4294-bcb8-17457230ab60" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de5a-401e-0028-50b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:39 GMT", + "x-ms-client-request-id" : "9864f68d-f933-4294-bcb8-17457230ab60" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosign091866176b5675be3b4", "javablobblobsasimplutilstringtosign137927f07f39a8200" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[7].json new file mode 100644 index 000000000000..748592a5b145 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[7].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign0552562cc1b1eee54b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "3568f391-2caa-4174-9e79-9ea2afb63f27" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA41B95EC2", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a25c6-a01e-0020-17b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:39 GMT", + "x-ms-client-request-id" : "3568f391-2caa-4174-9e79-9ea2afb63f27" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign0552562cc1b1eee54b4/javablobblobsasimplutilstringtosign162570189752dce69", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "1e4c8d4b-7cbb-4002-b192-0fdecb47bfc9", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA41C62A20", + "Content-Length" : "0", + "x-ms-request-id" : "d921de5b-401e-0028-51b3-a3f393000000", + "x-ms-client-request-id" : "1e4c8d4b-7cbb-4002-b192-0fdecb47bfc9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "1a146747-bd35-4c5c-926c-2eb3c601cf94" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a25ca-a01e-0020-1ab3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignjtcblobsasimplutilstringtosign0552562cc1b1eee54b4Mon, 25 Nov 2019 17:09:39 GMT\"0x8D771CA41B95EC2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:39 GMT", + "x-ms-client-request-id" : "1a146747-bd35-4c5c-926c-2eb3c601cf94", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign0552562cc1b1eee54b4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "872ffd63-00a4-419e-ac6b-d329c09e0355" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de63-401e-0028-59b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:39 GMT", + "x-ms-client-request-id" : "872ffd63-00a4-419e-ac6b-d329c09e0355" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosign0552562cc1b1eee54b4", "javablobblobsasimplutilstringtosign162570189752dce69" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[8].json new file mode 100644 index 000000000000..37681c6a00cb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[8].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign05318598eb9e81af1c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "82ba6078-98f7-45f5-a46b-8c3707962fc9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA41ED733D", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a25cc-a01e-0020-1cb3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:39 GMT", + "x-ms-client-request-id" : "82ba6078-98f7-45f5-a46b-8c3707962fc9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign05318598eb9e81af1c4/javablobblobsasimplutilstringtosign1314354c0b61e35df", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "5ec46370-79a6-48b3-9b38-622b11ed921d", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA41FA59C1", + "Content-Length" : "0", + "x-ms-request-id" : "d921de65-401e-0028-5bb3-a3f393000000", + "x-ms-client-request-id" : "5ec46370-79a6-48b3-9b38-622b11ed921d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "9e7644f6-30c9-4ccd-96d2-697d64414d9e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a25cf-a01e-0020-1eb3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignjtcblobsasimplutilstringtosign05318598eb9e81af1c4Mon, 25 Nov 2019 17:09:39 GMT\"0x8D771CA41ED733D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:39 GMT", + "x-ms-client-request-id" : "9e7644f6-30c9-4ccd-96d2-697d64414d9e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign05318598eb9e81af1c4?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "ba06f286-0ef0-4d13-975c-fe5a1cba82fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de67-401e-0028-5db3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:39 GMT", + "x-ms-client-request-id" : "ba06f286-0ef0-4d13-975c-fe5a1cba82fa" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosign05318598eb9e81af1c4", "javablobblobsasimplutilstringtosign1314354c0b61e35df" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[9].json new file mode 100644 index 000000000000..a3f2bd19d9b6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosign[9].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign022823f54d248018564?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "2c9704ac-1b25-4866-83a5-c75ac6d9b2bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA4221FCB7", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a25d3-a01e-0020-22b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:40 GMT", + "x-ms-client-request-id" : "2c9704ac-1b25-4866-83a5-c75ac6d9b2bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign022823f54d248018564/javablobblobsasimplutilstringtosign139652c1e391d21f0", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "a20c7bd7-b3b5-42ea-812c-0f77e5167d5e", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA422F2536", + "Content-Length" : "0", + "x-ms-request-id" : "d921de6a-401e-0028-5fb3-a3f393000000", + "x-ms-client-request-id" : "a20c7bd7-b3b5-42ea-812c-0f77e5167d5e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosign&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "773a9382-7948-4610-a910-31f3b0ed0b96" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a25d6-a01e-0020-24b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignjtcblobsasimplutilstringtosign022823f54d248018564Mon, 25 Nov 2019 17:09:40 GMT\"0x8D771CA4221FCB7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:40 GMT", + "x-ms-client-request-id" : "773a9382-7948-4610-a910-31f3b0ed0b96", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosign022823f54d248018564?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "4ed1b3db-0752-4cb4-a766-5dbec552e9d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de74-401e-0028-68b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:40 GMT", + "x-ms-client-request-id" : "4ed1b3db-0752-4cb4-a766-5dbec552e9d6" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosign022823f54d248018564", "javablobblobsasimplutilstringtosign139652c1e391d21f0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[0].json new file mode 100644 index 000000000000..cdc67a31822f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[0].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey03929314ec0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "17bf3bd0-45f0-438a-8728-ead5bc8548cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA425770FD", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a25d9-a01e-0020-27b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:40 GMT", + "x-ms-client-request-id" : "17bf3bd0-45f0-438a-8728-ead5bc8548cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey03929314ec0/javablobblobsasimplutilstringtosignuserdelegationkey18484377", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "c1441cd8-bf6f-4300-b81a-313506e4808a", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA42641802", + "Content-Length" : "0", + "x-ms-request-id" : "d921de7b-401e-0028-6fb3-a3f393000000", + "x-ms-client-request-id" : "c1441cd8-bf6f-4300-b81a-313506e4808a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "2b050d2b-1012-40fd-b3b7-5ca58024b26d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a25de-a01e-0020-2bb3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey03929314ec0Mon, 25 Nov 2019 17:09:40 GMT\"0x8D771CA425770FD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:40 GMT", + "x-ms-client-request-id" : "2b050d2b-1012-40fd-b3b7-5ca58024b26d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey03929314ec0?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "c2f7048a-0f8b-4f1a-bfa9-c2e03bef9400" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de84-401e-0028-78b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:40 GMT", + "x-ms-client-request-id" : "c2f7048a-0f8b-4f1a-bfa9-c2e03bef9400" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey03929314ec0", "javablobblobsasimplutilstringtosignuserdelegationkey18484377" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[10].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[10].json new file mode 100644 index 000000000000..4d11d89351ee --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[10].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey0911422df83?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "e2c7c4f3-f72d-4adf-b139-9ae403b05719" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA44743E15", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2634-a01e-0020-71b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:43 GMT", + "x-ms-client-request-id" : "e2c7c4f3-f72d-4adf-b139-9ae403b05719" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey0911422df83/javablobblobsasimplutilstringtosignuserdelegationkey17029077", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "07ff9eb9-c7f9-4de4-a409-e820600f60f7", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA44812BD3", + "Content-Length" : "0", + "x-ms-request-id" : "d921deee-401e-0028-5cb3-a3f393000000", + "x-ms-client-request-id" : "07ff9eb9-c7f9-4de4-a409-e820600f60f7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "9c2ceb83-aab0-4db9-90de-04e2c0e46a24" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2636-a01e-0020-72b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey0911422df83Mon, 25 Nov 2019 17:09:44 GMT\"0x8D771CA44743E15\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:43 GMT", + "x-ms-client-request-id" : "9c2ceb83-aab0-4db9-90de-04e2c0e46a24", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey0911422df83?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "bc286259-1529-4755-80ee-06c9676d99cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921def7-401e-0028-65b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:44 GMT", + "x-ms-client-request-id" : "bc286259-1529-4755-80ee-06c9676d99cc" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey0911422df83", "javablobblobsasimplutilstringtosignuserdelegationkey17029077" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[11].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[11].json new file mode 100644 index 000000000000..018c7281272e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[11].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey073672052c1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "c8220a33-4d9c-495c-ad95-345a44f3e149" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA44A9D96E", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2638-a01e-0020-74b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:44 GMT", + "x-ms-client-request-id" : "c8220a33-4d9c-495c-ad95-345a44f3e149" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey073672052c1/javablobblobsasimplutilstringtosignuserdelegationkey14339622", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "88d7bde6-b5cc-4e41-a4f5-3e61df2ef113", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA44B66E35", + "Content-Length" : "0", + "x-ms-request-id" : "d921defc-401e-0028-6ab3-a3f393000000", + "x-ms-client-request-id" : "88d7bde6-b5cc-4e41-a4f5-3e61df2ef113" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "b4d1fcb3-c8f6-4699-96f8-ff61d4b0462e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a263d-a01e-0020-78b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey073672052c1Mon, 25 Nov 2019 17:09:44 GMT\"0x8D771CA44A9D96E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:44 GMT", + "x-ms-client-request-id" : "b4d1fcb3-c8f6-4699-96f8-ff61d4b0462e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey073672052c1?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "e204e9f3-d4dd-4414-8442-4d6b23c168df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921deff-401e-0028-6db3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:44 GMT", + "x-ms-client-request-id" : "e204e9f3-d4dd-4414-8442-4d6b23c168df" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey073672052c1", "javablobblobsasimplutilstringtosignuserdelegationkey14339622" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[12].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[12].json new file mode 100644 index 000000000000..8eef25ffad03 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[12].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey087868008c3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "4b031ff5-ca8a-4b83-ad05-0f3eef129bd3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA44DD034A", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a265a-a01e-0020-13b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:44 GMT", + "x-ms-client-request-id" : "4b031ff5-ca8a-4b83-ad05-0f3eef129bd3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey087868008c3/javablobblobsasimplutilstringtosignuserdelegationkey176754ba", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "f22e68f2-58c9-449c-8987-5ca6f0c11bb4", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA44EA2814", + "Content-Length" : "0", + "x-ms-request-id" : "d921df02-401e-0028-70b3-a3f393000000", + "x-ms-client-request-id" : "f22e68f2-58c9-449c-8987-5ca6f0c11bb4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "870478da-c203-4391-9e16-4077783088fe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a265c-a01e-0020-14b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey087868008c3Mon, 25 Nov 2019 17:09:44 GMT\"0x8D771CA44DD034A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:44 GMT", + "x-ms-client-request-id" : "870478da-c203-4391-9e16-4077783088fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey087868008c3?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "9c6ed92e-7e62-4d93-b6d9-aa786ce575bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921df08-401e-0028-73b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:44 GMT", + "x-ms-client-request-id" : "9c6ed92e-7e62-4d93-b6d9-aa786ce575bb" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey087868008c3", "javablobblobsasimplutilstringtosignuserdelegationkey176754ba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[13].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[13].json new file mode 100644 index 000000000000..ee041df063d9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[13].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey071397cb8b8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "47442d80-8cb1-41cb-99dc-6718339993d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA4512525D", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2662-a01e-0020-1ab3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:44 GMT", + "x-ms-client-request-id" : "47442d80-8cb1-41cb-99dc-6718339993d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey071397cb8b8/javablobblobsasimplutilstringtosignuserdelegationkey1974360c", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "3f1c5377-62ae-442e-8072-74a24c9c94cb", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA451F41EE", + "Content-Length" : "0", + "x-ms-request-id" : "d921df0c-401e-0028-77b3-a3f393000000", + "x-ms-client-request-id" : "3f1c5377-62ae-442e-8072-74a24c9c94cb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "9b635e35-c3c8-4186-adf1-4edc7d92488e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2666-a01e-0020-1db3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey071397cb8b8Mon, 25 Nov 2019 17:09:45 GMT\"0x8D771CA4512525D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:44 GMT", + "x-ms-client-request-id" : "9b635e35-c3c8-4186-adf1-4edc7d92488e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey071397cb8b8?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "1825ee2b-0841-429a-9c29-7e1b20dbb3b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921df13-401e-0028-7eb3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:45 GMT", + "x-ms-client-request-id" : "1825ee2b-0841-429a-9c29-7e1b20dbb3b4" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey071397cb8b8", "javablobblobsasimplutilstringtosignuserdelegationkey1974360c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[14].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[14].json new file mode 100644 index 000000000000..b60c90395158 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[14].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey08761697965?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "46a71f5f-4b60-4f5d-8e93-f9e941f4975a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA45522760", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a266e-a01e-0020-22b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:45 GMT", + "x-ms-client-request-id" : "46a71f5f-4b60-4f5d-8e93-f9e941f4975a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey08761697965/javablobblobsasimplutilstringtosignuserdelegationkey18532120", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "812aa35b-d09d-4dfe-ae57-3b37360691e8", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA455EE171", + "Content-Length" : "0", + "x-ms-request-id" : "d921df17-401e-0028-02b3-a3f393000000", + "x-ms-client-request-id" : "812aa35b-d09d-4dfe-ae57-3b37360691e8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "d20231f8-d8d3-4247-a81f-9e42ff4d45fb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2678-a01e-0020-28b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey08761697965Mon, 25 Nov 2019 17:09:45 GMT\"0x8D771CA45522760\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:45 GMT", + "x-ms-client-request-id" : "d20231f8-d8d3-4247-a81f-9e42ff4d45fb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey08761697965?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "04fe76a1-e261-4a62-aabb-6713f571b879" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921df1d-401e-0028-08b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:45 GMT", + "x-ms-client-request-id" : "04fe76a1-e261-4a62-aabb-6713f571b879" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey08761697965", "javablobblobsasimplutilstringtosignuserdelegationkey18532120" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[1].json new file mode 100644 index 000000000000..96d5021204a4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[1].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey076590ba3a2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "e2e8c27c-3861-4978-9aeb-5621a9f15bb9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA428CE51F", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a25e2-a01e-0020-2eb3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:40 GMT", + "x-ms-client-request-id" : "e2e8c27c-3861-4978-9aeb-5621a9f15bb9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey076590ba3a2/javablobblobsasimplutilstringtosignuserdelegationkey14828914", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "4da07904-c3da-4c0e-a30d-e07db571ea0f", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA4299F510", + "Content-Length" : "0", + "x-ms-request-id" : "d921de87-401e-0028-7bb3-a3f393000000", + "x-ms-client-request-id" : "4da07904-c3da-4c0e-a30d-e07db571ea0f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "cfda1de5-59f6-4938-815b-c60e35dca2e8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a25e6-a01e-0020-31b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey076590ba3a2Mon, 25 Nov 2019 17:09:41 GMT\"0x8D771CA428CE51F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:40 GMT", + "x-ms-client-request-id" : "cfda1de5-59f6-4938-815b-c60e35dca2e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey076590ba3a2?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "bd56ebd5-40ab-444a-a2ae-b76993391517" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de8a-401e-0028-7eb3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:40 GMT", + "x-ms-client-request-id" : "bd56ebd5-40ab-444a-a2ae-b76993391517" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey076590ba3a2", "javablobblobsasimplutilstringtosignuserdelegationkey14828914" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[2].json new file mode 100644 index 000000000000..c298fa0f3b80 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[2].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey025795e26ed?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "7103f67b-3a77-47a0-ab28-18ab0fef0e92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA42C0AB52", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a25e7-a01e-0020-32b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:41 GMT", + "x-ms-client-request-id" : "7103f67b-3a77-47a0-ab28-18ab0fef0e92" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey025795e26ed/javablobblobsasimplutilstringtosignuserdelegationkey13714371", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "e71c0ff3-8ab5-4147-b8c0-9f3fbc123e14", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA42CD87F5", + "Content-Length" : "0", + "x-ms-request-id" : "d921de91-401e-0028-05b3-a3f393000000", + "x-ms-client-request-id" : "e71c0ff3-8ab5-4147-b8c0-9f3fbc123e14" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "cd9d80cf-5f7d-47ac-8fc6-13a75ec2eac1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a25eb-a01e-0020-35b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey025795e26edMon, 25 Nov 2019 17:09:41 GMT\"0x8D771CA42C0AB52\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:41 GMT", + "x-ms-client-request-id" : "cd9d80cf-5f7d-47ac-8fc6-13a75ec2eac1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey025795e26ed?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "beff9c5a-99a9-4e9b-a278-216d4e98a20a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de92-401e-0028-06b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:41 GMT", + "x-ms-client-request-id" : "beff9c5a-99a9-4e9b-a278-216d4e98a20a" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey025795e26ed", "javablobblobsasimplutilstringtosignuserdelegationkey13714371" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[3].json new file mode 100644 index 000000000000..077c257e7a6a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[3].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey02017629dee?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "c7eafce6-9e33-419a-b024-7e3d664ef873" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA42FCD7C1", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a25ef-a01e-0020-39b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:41 GMT", + "x-ms-client-request-id" : "c7eafce6-9e33-419a-b024-7e3d664ef873" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey02017629dee/javablobblobsasimplutilstringtosignuserdelegationkey1487395a", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "fcf0088c-bc82-4b4f-b863-7abd2ff52a22", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA430A1DB3", + "Content-Length" : "0", + "x-ms-request-id" : "d921de99-401e-0028-0cb3-a3f393000000", + "x-ms-client-request-id" : "fcf0088c-bc82-4b4f-b863-7abd2ff52a22" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "444e0192-6069-4832-862d-81f4f040601a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a25f5-a01e-0020-3eb3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey02017629deeMon, 25 Nov 2019 17:09:41 GMT\"0x8D771CA42FCD7C1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:41 GMT", + "x-ms-client-request-id" : "444e0192-6069-4832-862d-81f4f040601a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey02017629dee?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "62c90758-67a0-45c4-89c4-5614d6853ec6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921dea2-401e-0028-14b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:41 GMT", + "x-ms-client-request-id" : "62c90758-67a0-45c4-89c4-5614d6853ec6" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey02017629dee", "javablobblobsasimplutilstringtosignuserdelegationkey1487395a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[4].json new file mode 100644 index 000000000000..83bffc113e07 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[4].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey02473993d39?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "2f7cb5d5-08f6-4a0f-a233-56b88bad837e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA4332E9E3", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a25f8-a01e-0020-41b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:41 GMT", + "x-ms-client-request-id" : "2f7cb5d5-08f6-4a0f-a233-56b88bad837e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey02473993d39/javablobblobsasimplutilstringtosignuserdelegationkey12957369", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "bdda2274-cc6e-4928-a0bf-8c965996888e", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA434724D2", + "Content-Length" : "0", + "x-ms-request-id" : "d921deaa-401e-0028-1bb3-a3f393000000", + "x-ms-client-request-id" : "bdda2274-cc6e-4928-a0bf-8c965996888e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "55a8a088-e0d0-4abf-9394-a22c5335a534" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a25fc-a01e-0020-44b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey02473993d39Mon, 25 Nov 2019 17:09:42 GMT\"0x8D771CA4332E9E3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:41 GMT", + "x-ms-client-request-id" : "55a8a088-e0d0-4abf-9394-a22c5335a534", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey02473993d39?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "34cdc826-6bf8-41d6-a701-6e87c0448899" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921deb1-401e-0028-22b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:42 GMT", + "x-ms-client-request-id" : "34cdc826-6bf8-41d6-a701-6e87c0448899" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey02473993d39", "javablobblobsasimplutilstringtosignuserdelegationkey12957369" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[5].json new file mode 100644 index 000000000000..c608e28d7826 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[5].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey063410f139f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "588641a6-3e27-46ba-91b5-f9b352b76400" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA436E9FA5", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a25ff-a01e-0020-47b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:42 GMT", + "x-ms-client-request-id" : "588641a6-3e27-46ba-91b5-f9b352b76400" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey063410f139f/javablobblobsasimplutilstringtosignuserdelegationkey15231708", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "5e000009-d9b0-4e67-84a4-8d742f037b38", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA437B7B4A", + "Content-Length" : "0", + "x-ms-request-id" : "d921deba-401e-0028-2bb3-a3f393000000", + "x-ms-client-request-id" : "5e000009-d9b0-4e67-84a4-8d742f037b38" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "7679cfa3-3008-4b68-ae82-50b611604580" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2605-a01e-0020-4ab3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey063410f139fMon, 25 Nov 2019 17:09:42 GMT\"0x8D771CA436E9FA5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:42 GMT", + "x-ms-client-request-id" : "7679cfa3-3008-4b68-ae82-50b611604580", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey063410f139f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "be4c4b26-f15b-4237-86b1-420aadd1cb2b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921dec1-401e-0028-31b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:42 GMT", + "x-ms-client-request-id" : "be4c4b26-f15b-4237-86b1-420aadd1cb2b" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey063410f139f", "javablobblobsasimplutilstringtosignuserdelegationkey15231708" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[6].json new file mode 100644 index 000000000000..11e44901c188 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[6].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey029045b1b81?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "51dcda44-364e-400f-a969-120bcf6d6d7f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA43A39E85", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2607-a01e-0020-4cb3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:42 GMT", + "x-ms-client-request-id" : "51dcda44-364e-400f-a969-120bcf6d6d7f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey029045b1b81/javablobblobsasimplutilstringtosignuserdelegationkey19564401", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "fedae4f4-3ada-4bd6-8043-0080f6587597", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA43B13130", + "Content-Length" : "0", + "x-ms-request-id" : "d921dec9-401e-0028-38b3-a3f393000000", + "x-ms-client-request-id" : "fedae4f4-3ada-4bd6-8043-0080f6587597" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "413f7f34-ffb9-4f4d-9c13-9d6ebea3dc44" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a260c-a01e-0020-50b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey029045b1b81Mon, 25 Nov 2019 17:09:42 GMT\"0x8D771CA43A39E85\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:42 GMT", + "x-ms-client-request-id" : "413f7f34-ffb9-4f4d-9c13-9d6ebea3dc44", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey029045b1b81?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "f27c654c-e491-44f2-9eb1-79dd86dfaf7d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921dece-401e-0028-3db3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:42 GMT", + "x-ms-client-request-id" : "f27c654c-e491-44f2-9eb1-79dd86dfaf7d" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey029045b1b81", "javablobblobsasimplutilstringtosignuserdelegationkey19564401" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[7].json new file mode 100644 index 000000000000..4cbeb8bf3e1b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[7].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey05135850d25?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "e9346af3-28e3-463d-a749-4f1f69bcf7df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA43D8C749", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2610-a01e-0020-54b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:42 GMT", + "x-ms-client-request-id" : "e9346af3-28e3-463d-a749-4f1f69bcf7df" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey05135850d25/javablobblobsasimplutilstringtosignuserdelegationkey1064067d", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "4cc00dcd-2048-4bb5-89f1-cc25455ebac0", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA43E5FCDD", + "Content-Length" : "0", + "x-ms-request-id" : "d921ded2-401e-0028-41b3-a3f393000000", + "x-ms-client-request-id" : "4cc00dcd-2048-4bb5-89f1-cc25455ebac0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "a70d7206-8a61-44ab-be99-94e595a86415" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2615-a01e-0020-58b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey05135850d25Mon, 25 Nov 2019 17:09:43 GMT\"0x8D771CA43D8C749\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:42 GMT", + "x-ms-client-request-id" : "a70d7206-8a61-44ab-be99-94e595a86415", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey05135850d25?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "1960b173-a6a6-4b08-8369-f74dea612dd1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921ded9-401e-0028-48b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:43 GMT", + "x-ms-client-request-id" : "1960b173-a6a6-4b08-8369-f74dea612dd1" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey05135850d25", "javablobblobsasimplutilstringtosignuserdelegationkey1064067d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[8].json new file mode 100644 index 000000000000..8b9b91e65748 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[8].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey062690f6788?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "1b7b4e56-245a-4cef-83fd-5dafa0db0a5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA440D2856", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2619-a01e-0020-5bb3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:43 GMT", + "x-ms-client-request-id" : "1b7b4e56-245a-4cef-83fd-5dafa0db0a5c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey062690f6788/javablobblobsasimplutilstringtosignuserdelegationkey1301424f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "35067472-55ca-46f3-a672-7b65065a6465", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA4419DE5A", + "Content-Length" : "0", + "x-ms-request-id" : "d921dee0-401e-0028-4fb3-a3f393000000", + "x-ms-client-request-id" : "35067472-55ca-46f3-a672-7b65065a6465" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "37a8d9b4-ae37-4e62-8c68-eadec0481be6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2621-a01e-0020-62b3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey062690f6788Mon, 25 Nov 2019 17:09:43 GMT\"0x8D771CA440D2856\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:43 GMT", + "x-ms-client-request-id" : "37a8d9b4-ae37-4e62-8c68-eadec0481be6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey062690f6788?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "d52840a9-fb7e-4fe0-8d82-dcab473ff939" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921dee3-401e-0028-52b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:43 GMT", + "x-ms-client-request-id" : "d52840a9-fb7e-4fe0-8d82-dcab473ff939" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey062690f6788", "javablobblobsasimplutilstringtosignuserdelegationkey1301424f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[9].json new file mode 100644 index 000000000000..85080524a4f8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobsasimplutilstringtosignuserdelegationkey[9].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey08747327bcc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "b6150a2b-88ba-482e-8933-2989533a206c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA4440C76C", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2627-a01e-0020-68b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:43 GMT", + "x-ms-client-request-id" : "b6150a2b-88ba-482e-8933-2989533a206c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey08747327bcc/javablobblobsasimplutilstringtosignuserdelegationkey1203842b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "4f747b0f-dd88-4121-8790-c525adb922f9", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA444D71D3", + "Content-Length" : "0", + "x-ms-request-id" : "d921dee4-401e-0028-53b3-a3f393000000", + "x-ms-client-request-id" : "4f747b0f-dd88-4121-8790-c525adb922f9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobsasimplutilstringtosignuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "10d5415a-9a2d-47cd-a017-05d21bc44861" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2630-a01e-0020-6fb3-a3e99c000000", + "Body" : "jtcblobsasimplutilstringtosignuserdelegationkeyjtcblobsasimplutilstringtosignuserdelegationkey08747327bccMon, 25 Nov 2019 17:09:43 GMT\"0x8D771CA4440C76C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:43 GMT", + "x-ms-client-request-id" : "10d5415a-9a2d-47cd-a017-05d21bc44861", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobsasimplutilstringtosignuserdelegationkey08747327bcc?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "9eb6bb8d-5bae-457d-9368-5c6739e02ae3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921dee8-401e-0028-57b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:43 GMT", + "x-ms-client-request-id" : "9eb6bb8d-5bae-457d-9368-5c6739e02ae3" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsasimplutilstringtosignuserdelegationkey08747327bcc", "javablobblobsasimplutilstringtosignuserdelegationkey1203842b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobservicesasnetworktestblobsnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobservicesasnetworktestblobsnapshot.json new file mode 100644 index 000000000000..9ad3b844f492 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsblobservicesasnetworktestblobsnapshot.json @@ -0,0 +1,197 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot057825a9fde690?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "1f44cfe0-ab8a-4c8d-b597-1056ab533f7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3C8E00AF", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a24b1-a01e-0020-3db3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:30 GMT", + "x-ms-client-request-id" : "1f44cfe0-ab8a-4c8d-b597-1056ab533f7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot057825a9fde690/javablobblobservicesasnetworktestblobsnapshot136413f6bd2f", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "4f682785-9445-4a1b-a2e8-ab520f9737d5", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3C9AEB92", + "Content-Length" : "0", + "x-ms-request-id" : "d921dd27-401e-0028-44b3-a3f393000000", + "x-ms-client-request-id" : "4f682785-9445-4a1b-a2e8-ab520f9737d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot057825a9fde690/javablobblobservicesasnetworktestblobsnapshot136413f6bd2f?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "c8870872-28d4-45f8-8ae0-6009013eebfb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-11-25T17:09:31.1292895Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3C9AEB92", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a24bc-a01e-0020-44b3-a3e99c000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 25 Nov 2019 17:09:30 GMT", + "x-ms-client-request-id" : "c8870872-28d4-45f8-8ae0-6009013eebfb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot057825a9fde690/javablobblobservicesasnetworktestblobsnapshot136413f6bd2f?sv=2019-02-02&spr=https%2Chttp&st=2019-11-24T17%3A09%3A31Z&se=2019-11-26T17%3A09%3A31Z&sip=0.0.0.0-255.255.255.255&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "171103a0-02b8-4b2b-8188-de23e67beab2" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "447", + "StatusCode" : "403", + "x-ms-request-id" : "d921dd2f-401e-0028-4bb3-a3f393000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:d921dd2f-401e-0028-4bb3-a3f393000000\nTime:2019-11-25T17:09:31.2147725ZThe specified signed resource is not allowed for the this resource level", + "Date" : "Mon, 25 Nov 2019 17:09:30 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot057825a9fde690/javablobblobservicesasnetworktestblobsnapshot136413f6bd2f?snapshot=2019-11-25T17%3a09%3a31.1292895Z&sv=2019-02-02&spr=https%2Chttp&st=2019-11-24T17%3A09%3A31Z&se=2019-11-26T17%3A09%3A31Z&sip=0.0.0.0-255.255.255.255&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "acdff660-793e-45f4-b116-9deb5acab1d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 25 Nov 2019 17:09:30 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "cache", + "ETag" : "0x8D771CA3C9AEB92", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Mon, 25 Nov 2019 17:09:31 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "329a24c3-a01e-0020-47b3-a3e99c000000", + "Body" : "default", + "x-ms-client-request-id" : "acdff660-793e-45f4-b116-9deb5acab1d3", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot057825a9fde690/javablobblobservicesasnetworktestblobsnapshot136413f6bd2f?snapshot=2019-11-25T17%3a09%3a31.1292895Z&sv=2019-02-02&spr=https%2Chttp&st=2019-11-24T17%3A09%3A31Z&se=2019-11-26T17%3A09%3A31Z&sip=0.0.0.0-255.255.255.255&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "08758b9e-a78e-42d6-9962-b47a8b017b7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 25 Nov 2019 17:09:30 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Cache-Control" : "cache", + "ETag" : "0x8D771CA3C9AEB92", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Mon, 25 Nov 2019 17:09:31 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d921dd37-401e-0028-53b3-a3f393000000", + "x-ms-client-request-id" : "08758b9e-a78e-42d6-9962-b47a8b017b7c", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcblobservicesasnetworktestblobsnapshot&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "9470105e-7885-4f46-812f-51b073db267a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a24c4-a01e-0020-48b3-a3e99c000000", + "Body" : "jtcblobservicesasnetworktestblobsnapshotjtcblobservicesasnetworktestblobsnapshot057825a9fde690Mon, 25 Nov 2019 17:09:30 GMT\"0x8D771CA3C8E00AF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:30 GMT", + "x-ms-client-request-id" : "9470105e-7885-4f46-812f-51b073db267a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot057825a9fde690?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "75a8ba08-34bd-4e3d-9cac-1c64ea4c3a3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921dd44-401e-0028-5db3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:30 GMT", + "x-ms-client-request-id" : "75a8ba08-34bd-4e3d-9cac-1c64ea4c3a3c" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobservicesasnetworktestblobsnapshot057825a9fde690", "javablobblobservicesasnetworktestblobsnapshot136413f6bd2f", "2019-11-25T17:09:31.104721500Z", "2019-11-25T17:09:31.104721500Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateillegalargument.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateillegalargument.json new file mode 100644 index 000000000000..597a5de858bc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateillegalargument.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateillegalargument079451bb4ed7a903b84a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "1c829f9c-6441-4ffe-abb5-089597b1b5f1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3F6F36E1", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2538-a01e-0020-20b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:35 GMT", + "x-ms-client-request-id" : "1c829f9c-6441-4ffe-abb5-089597b1b5f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateillegalargument079451bb4ed7a903b84a/javablobensurestateillegalargument1735024ef73b455fa", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "5966c7ad-6979-488e-9423-f464a2492962", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3F7C3A0F", + "Content-Length" : "0", + "x-ms-request-id" : "d921dde0-401e-0028-63b3-a3f393000000", + "x-ms-client-request-id" : "5966c7ad-6979-488e-9423-f464a2492962" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcensurestateillegalargument&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "a42eedd9-5026-415a-b105-bf33f01f3d5a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a253a-a01e-0020-21b3-a3e99c000000", + "Body" : "jtcensurestateillegalargumentjtcensurestateillegalargument079451bb4ed7a903b84aMon, 25 Nov 2019 17:09:35 GMT\"0x8D771CA3F6F36E1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:35 GMT", + "x-ms-client-request-id" : "a42eedd9-5026-415a-b105-bf33f01f3d5a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateillegalargument079451bb4ed7a903b84a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "a2958187-6472-4e14-9053-9992d83790dd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921dde3-401e-0028-66b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:35 GMT", + "x-ms-client-request-id" : "a2958187-6472-4e14-9053-9992d83790dd" + }, + "Exception" : null + } ], + "variables" : [ "jtcensurestateillegalargument079451bb4ed7a903b84a", "javablobensurestateillegalargument1735024ef73b455fa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateresourceandpermission[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateresourceandpermission[0].json new file mode 100644 index 000000000000..4be15ef72253 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateresourceandpermission[0].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateresourceandpermission044225f9396c21d36?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "841416d0-62a4-4995-bc4f-d0b429e8525b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3FA56F75", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2546-a01e-0020-2ab3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:35 GMT", + "x-ms-client-request-id" : "841416d0-62a4-4995-bc4f-d0b429e8525b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateresourceandpermission044225f9396c21d36/javablobensurestateresourceandpermission19187238b020bb", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "1df17c3d-27b1-4e78-bf4b-9d688c900d95", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3FB23DF3", + "Content-Length" : "0", + "x-ms-request-id" : "d921dde9-401e-0028-6cb3-a3f393000000", + "x-ms-client-request-id" : "1df17c3d-27b1-4e78-bf4b-9d688c900d95" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcensurestateresourceandpermission&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "e4b1464c-d4f6-4ab7-918b-2f3a28da8ced" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2549-a01e-0020-2cb3-a3e99c000000", + "Body" : "jtcensurestateresourceandpermissionjtcensurestateresourceandpermission044225f9396c21d36Mon, 25 Nov 2019 17:09:36 GMT\"0x8D771CA3FA56F75\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:36 GMT", + "x-ms-client-request-id" : "e4b1464c-d4f6-4ab7-918b-2f3a28da8ced", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateresourceandpermission044225f9396c21d36?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "2828ab16-2b9f-44ce-8dd9-a96b66ee39ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921ddeb-401e-0028-6eb3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:36 GMT", + "x-ms-client-request-id" : "2828ab16-2b9f-44ce-8dd9-a96b66ee39ff" + }, + "Exception" : null + } ], + "variables" : [ "jtcensurestateresourceandpermission044225f9396c21d36", "javablobensurestateresourceandpermission19187238b020bb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateresourceandpermission[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateresourceandpermission[1].json new file mode 100644 index 000000000000..dc1fa056ca50 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateresourceandpermission[1].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateresourceandpermission067424a73973c26da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "1f73436c-0907-4d87-b210-c7a49431fe85" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3FD90C4B", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2550-a01e-0020-31b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:36 GMT", + "x-ms-client-request-id" : "1f73436c-0907-4d87-b210-c7a49431fe85" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateresourceandpermission067424a73973c26da/javablobensurestateresourceandpermission162311a8707d07", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "c3c3191d-b7e1-47db-95d8-5452fadf39f6", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3FE5F812", + "Content-Length" : "0", + "x-ms-request-id" : "d921ddef-401e-0028-72b3-a3f393000000", + "x-ms-client-request-id" : "c3c3191d-b7e1-47db-95d8-5452fadf39f6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcensurestateresourceandpermission&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "1126774b-1c92-4126-934e-1c03315d7c6c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2554-a01e-0020-34b3-a3e99c000000", + "Body" : "jtcensurestateresourceandpermissionjtcensurestateresourceandpermission067424a73973c26daMon, 25 Nov 2019 17:09:36 GMT\"0x8D771CA3FD90C4B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:36 GMT", + "x-ms-client-request-id" : "1126774b-1c92-4126-934e-1c03315d7c6c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateresourceandpermission067424a73973c26da?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "ac57f5c2-423d-4eb2-97d8-4ec29758137d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921ddf4-401e-0028-76b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:36 GMT", + "x-ms-client-request-id" : "ac57f5c2-423d-4eb2-97d8-4ec29758137d" + }, + "Exception" : null + } ], + "variables" : [ "jtcensurestateresourceandpermission067424a73973c26da", "javablobensurestateresourceandpermission162311a8707d07" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateresourceandpermission[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateresourceandpermission[2].json new file mode 100644 index 000000000000..82952fb9ad4b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateresourceandpermission[2].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateresourceandpermission007063c512bf3c775?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "5a3fb7d4-b1f0-49d8-901e-64ecef188895" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA400D95C5", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a2558-a01e-0020-37b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:36 GMT", + "x-ms-client-request-id" : "5a3fb7d4-b1f0-49d8-901e-64ecef188895" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateresourceandpermission007063c512bf3c775/javablobensurestateresourceandpermission186155a746a144", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "c8486568-bb4c-452a-b044-8619e01d0395", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA401AEB2B", + "Content-Length" : "0", + "x-ms-request-id" : "d921ddfc-401e-0028-7db3-a3f393000000", + "x-ms-client-request-id" : "c8486568-bb4c-452a-b044-8619e01d0395" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcensurestateresourceandpermission&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "161e87f7-ac8e-4bf1-9dfb-404a81fc2fb9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a255c-a01e-0020-3ab3-a3e99c000000", + "Body" : "jtcensurestateresourceandpermissionjtcensurestateresourceandpermission007063c512bf3c775Mon, 25 Nov 2019 17:09:36 GMT\"0x8D771CA400D95C5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:36 GMT", + "x-ms-client-request-id" : "161e87f7-ac8e-4bf1-9dfb-404a81fc2fb9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateresourceandpermission007063c512bf3c775?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "92c86545-8830-4904-8ec1-11b3cbd93f10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921de03-401e-0028-04b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:36 GMT", + "x-ms-client-request-id" : "92c86545-8830-4904-8ec1-11b3cbd93f10" + }, + "Exception" : null + } ], + "variables" : [ "jtcensurestateresourceandpermission007063c512bf3c775", "javablobensurestateresourceandpermission186155a746a144" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateversion.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateversion.json new file mode 100644 index 000000000000..51405130d192 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsensurestateversion.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateversion0sasclienttestsensurestateversion7ef95525?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "32b2ae0f-3b31-4b50-b3ac-b1699511af61" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3F383C56", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a252f-a01e-0020-1ab3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:35 GMT", + "x-ms-client-request-id" : "32b2ae0f-3b31-4b50-b3ac-b1699511af61" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateversion0sasclienttestsensurestateversion7ef95525/javablobensurestateversion1174573473b33f9153412", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "141b6a76-1c5a-4b9b-93df-653a5295b9bc", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3F45E7E2", + "Content-Length" : "0", + "x-ms-request-id" : "d921ddd9-401e-0028-5cb3-a3f393000000", + "x-ms-client-request-id" : "141b6a76-1c5a-4b9b-93df-653a5295b9bc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcensurestateversion&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "3baba14d-bbff-4dc9-ba14-186800eb83aa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2536-a01e-0020-1eb3-a3e99c000000", + "Body" : "jtcensurestateversionjtcensurestateversion0sasclienttestsensurestateversion7ef95525Mon, 25 Nov 2019 17:09:35 GMT\"0x8D771CA3F383C56\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:35 GMT", + "x-ms-client-request-id" : "3baba14d-bbff-4dc9-ba14-186800eb83aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcensurestateversion0sasclienttestsensurestateversion7ef95525?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "7a92f80f-bbbb-4883-b79f-a8d0dbba9c03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921dddd-401e-0028-60b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:35 GMT", + "x-ms-client-request-id" : "7a92f80f-bbbb-4883-b79f-a8d0dbba9c03" + }, + "Exception" : null + } ], + "variables" : [ "jtcensurestateversion0sasclienttestsensurestateversion7ef95525", "javablobensurestateversion1174573473b33f9153412" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestblobsas.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestblobsas.json new file mode 100644 index 000000000000..a9cd35dee6a5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestblobsas.json @@ -0,0 +1,158 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsas0sasclienttestsnetworktestblobsas20158403?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "ca96f59b-6c9c-460b-a023-8c66928ca518" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA39C4C7A9", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a23d7-a01e-0020-74b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:25 GMT", + "x-ms-client-request-id" : "ca96f59b-6c9c-460b-a023-8c66928ca518" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsas0sasclienttestsnetworktestblobsas20158403/javablobnetworktestblobsas169768633e6e3cc62e49b", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "b6e58c52-3095-4e76-b9fe-36dff3809899", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA39E5B692", + "Content-Length" : "0", + "x-ms-request-id" : "329a23dd-a01e-0020-77b3-a3e99c000000", + "x-ms-client-request-id" : "b6e58c52-3095-4e76-b9fe-36dff3809899" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsas0sasclienttestsnetworktestblobsas20158403/javablobnetworktestblobsas169768633e6e3cc62e49b?sv=2019-02-02&spr=https%2Chttp&st=2019-11-24T17%3A09%3A26Z&se=2019-11-26T17%3A09%3A26Z&sip=0.0.0.0-255.255.255.255&sr=b&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "30576ea7-5b42-4468-80bb-7edcf0dd033d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:26 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 25 Nov 2019 17:09:25 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "cache", + "ETag" : "0x8D771CA39E5B692", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Mon, 25 Nov 2019 17:09:26 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "329a23df-a01e-0020-79b3-a3e99c000000", + "Body" : "default", + "x-ms-client-request-id" : "30576ea7-5b42-4468-80bb-7edcf0dd033d", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsas0sasclienttestsnetworktestblobsas20158403/javablobnetworktestblobsas169768633e6e3cc62e49b?sv=2019-02-02&spr=https%2Chttp&st=2019-11-24T17%3A09%3A26Z&se=2019-11-26T17%3A09%3A26Z&sip=0.0.0.0-255.255.255.255&sr=b&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "d72f4cf4-04ef-4d3f-be30-a1984f0fc437" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:26 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 25 Nov 2019 17:09:25 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Cache-Control" : "cache", + "ETag" : "0x8D771CA39E5B692", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Mon, 25 Nov 2019 17:09:26 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "329a23e1-a01e-0020-7bb3-a3e99c000000", + "x-ms-client-request-id" : "d72f4cf4-04ef-4d3f-be30-a1984f0fc437", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcnetworktestblobsas&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "2b506eaa-4fb3-4f28-ba44-c737a34271b2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a23e3-a01e-0020-7db3-a3e99c000000", + "Body" : "jtcnetworktestblobsasjtcnetworktestblobsas0sasclienttestsnetworktestblobsas20158403Mon, 25 Nov 2019 17:09:26 GMT\"0x8D771CA39C4C7A9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:26 GMT", + "x-ms-client-request-id" : "2b506eaa-4fb3-4f28-ba44-c737a34271b2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsas0sasclienttestsnetworktestblobsas20158403?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "6032dbfd-d5fa-4b2f-b2f6-3029aa80f231" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "329a23e4-a01e-0020-7eb3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:26 GMT", + "x-ms-client-request-id" : "6032dbfd-d5fa-4b2f-b2f6-3029aa80f231" + }, + "Exception" : null + } ], + "variables" : [ "jtcnetworktestblobsas0sasclienttestsnetworktestblobsas20158403", "javablobnetworktestblobsas169768633e6e3cc62e49b", "2019-11-25T17:09:26.498760400Z", "2019-11-25T17:09:26.501760400Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestblobsnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestblobsnapshot.json new file mode 100644 index 000000000000..6ac33e16ac1f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestblobsnapshot.json @@ -0,0 +1,202 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshot02540570aba2cd3d9e46f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "e09679a2-45d3-4bff-bdb6-f108d225fc1e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3A49A677", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a23e8-a01e-0020-02b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:26 GMT", + "x-ms-client-request-id" : "e09679a2-45d3-4bff-bdb6-f108d225fc1e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshot02540570aba2cd3d9e46f/javablobnetworktestblobsnapshot102035629499e132984", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "d11846ca-8d30-4a33-a0af-104f7c7230c6", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3A58C3C2", + "Content-Length" : "0", + "x-ms-request-id" : "329a23ec-a01e-0020-05b3-a3e99c000000", + "x-ms-client-request-id" : "d11846ca-8d30-4a33-a0af-104f7c7230c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshot02540570aba2cd3d9e46f/javablobnetworktestblobsnapshot2668120224a37c98254", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "e101a62d-b820-4910-9d33-55239c439a9b", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "Q7G6/s6+u/k=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:26 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "0x8D771CA3A68A2A6", + "Content-Length" : "0", + "x-ms-request-id" : "329a23ed-a01e-0020-06b3-a3e99c000000", + "x-ms-client-request-id" : "e101a62d-b820-4910-9d33-55239c439a9b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshot02540570aba2cd3d9e46f/javablobnetworktestblobsnapshot2668120224a37c98254?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "4e6e9613-eefb-49c4-a848-213edd0f8047" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-11-25T17:09:27.4562807Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3A68A2A6", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a23ef-a01e-0020-08b3-a3e99c000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 25 Nov 2019 17:09:26 GMT", + "x-ms-client-request-id" : "4e6e9613-eefb-49c4-a848-213edd0f8047" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshot02540570aba2cd3d9e46f/javablobnetworktestblobsnapshot2668120224a37c98254?snapshot=2019-11-25T17%3a09%3a27.4562807Z&sv=2019-02-02&spr=https%2Chttp&st=2019-11-24T17%3A09%3A27Z&se=2019-11-26T17%3A09%3A27Z&sip=0.0.0.0-255.255.255.255&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "de5631bd-d957-40ac-8348-a6a66856921e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 25 Nov 2019 17:09:26 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "cache", + "ETag" : "0x8D771CA3A68A2A6", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Mon, 25 Nov 2019 17:09:27 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "329a23f0-a01e-0020-09b3-a3e99c000000", + "Body" : "test", + "x-ms-client-request-id" : "de5631bd-d957-40ac-8348-a6a66856921e", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshot02540570aba2cd3d9e46f/javablobnetworktestblobsnapshot2668120224a37c98254?snapshot=2019-11-25T17%3a09%3a27.4562807Z&sv=2019-02-02&spr=https%2Chttp&st=2019-11-24T17%3A09%3A27Z&se=2019-11-26T17%3A09%3A27Z&sip=0.0.0.0-255.255.255.255&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "1d2832ad-763d-4623-ae69-9b6694ed8a66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 25 Nov 2019 17:09:26 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Cache-Control" : "cache", + "ETag" : "0x8D771CA3A68A2A6", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Mon, 25 Nov 2019 17:09:27 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "329a23f2-a01e-0020-0bb3-a3e99c000000", + "x-ms-client-request-id" : "1d2832ad-763d-4623-ae69-9b6694ed8a66", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcnetworktestblobsnapshot&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "7fc65b94-64bb-4dc8-be1f-086e9d3e273b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a23f3-a01e-0020-0cb3-a3e99c000000", + "Body" : "jtcnetworktestblobsnapshotjtcnetworktestblobsnapshot02540570aba2cd3d9e46fMon, 25 Nov 2019 17:09:27 GMT\"0x8D771CA3A49A677\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:26 GMT", + "x-ms-client-request-id" : "7fc65b94-64bb-4dc8-be1f-086e9d3e273b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshot02540570aba2cd3d9e46f?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "2af744ba-b0d1-4941-9511-295d592f009e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921dce2-401e-0028-0ab3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:27 GMT", + "x-ms-client-request-id" : "2af744ba-b0d1-4941-9511-295d592f009e" + }, + "Exception" : null + } ], + "variables" : [ "jtcnetworktestblobsnapshot02540570aba2cd3d9e46f", "javablobnetworktestblobsnapshot102035629499e132984", "javablobnetworktestblobsnapshot2668120224a37c98254", "2019-11-25T17:09:27.443868800Z", "2019-11-25T17:09:27.443868800Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestblobsnapshotuserdelegation.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestblobsnapshotuserdelegation.json new file mode 100644 index 000000000000..d78c4cd4f8fd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestblobsnapshotuserdelegation.json @@ -0,0 +1,219 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshotuserdelegation03840477362e2e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "b5d79c61-b4f7-4d5f-8c45-49b85715b9e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3CF78BD8", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a24c9-a01e-0020-4db3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:30 GMT", + "x-ms-client-request-id" : "b5d79c61-b4f7-4d5f-8c45-49b85715b9e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshotuserdelegation03840477362e2e/javablobnetworktestblobsnapshotuserdelegation120014caa048", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "2f41707f-4757-4141-af74-0b2bd05112cb", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3D04AA2E", + "Content-Length" : "0", + "x-ms-request-id" : "d921dd4f-401e-0028-66b3-a3f393000000", + "x-ms-client-request-id" : "2f41707f-4757-4141-af74-0b2bd05112cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshotuserdelegation03840477362e2e/javablobnetworktestblobsnapshotuserdelegation120014caa048?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "1d5053ed-4914-4814-9a67-22873929f97f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-11-25T17:09:31.8122954Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3D04AA2E", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a24e4-a01e-0020-65b3-a3e99c000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 25 Nov 2019 17:09:30 GMT", + "x-ms-client-request-id" : "1d5053ed-4914-4814-9a67-22873929f97f" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://gapradev.blob.core.windows.net?restype=service&comp=userdelegationkey", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "ecc43eea-ef70-43ee-b58a-bb7fde027d34", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d921dd5f-401e-0028-73b3-a3f393000000", + "Body" : "7a56bc7f-2460-439c-8e22-cc8f44b161238ef2432d-93d8-4e9a-a756-f9a8ee5544d72019-11-24T17:09:31Z2019-11-26T17:09:31Zb2019-02-02UkVEQUNURUQ=", + "Date" : "Mon, 25 Nov 2019 17:09:32 GMT", + "x-ms-client-request-id" : "ecc43eea-ef70-43ee-b58a-bb7fde027d34", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshotuserdelegation03840477362e2e/javablobnetworktestblobsnapshotuserdelegation120014caa048?sv=2019-02-02&spr=https%2Chttp&st=2019-11-24T17%3A09%3A31Z&se=2019-11-26T17%3A09%3A31Z&sip=0.0.0.0-255.255.255.255&skoid=c4f48289-bb84-4086-b250-6f94a8f64cee&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2019-11-24T17%3A09%3A31Z&ske=2019-11-26T17%3A09%3A31Z&sks=b&skv=2019-02-02&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "f16ddfaa-ba18-4c50-b868-9cbacd3ee66f" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "447", + "StatusCode" : "403", + "x-ms-request-id" : "329a24eb-a01e-0020-6ab3-a3e99c000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:329a24eb-a01e-0020-6ab3-a3e99c000000\nTime:2019-11-25T17:09:32.2487938ZThe specified signed resource is not allowed for the this resource level", + "Date" : "Mon, 25 Nov 2019 17:09:32 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshotuserdelegation03840477362e2e/javablobnetworktestblobsnapshotuserdelegation120014caa048?snapshot=2019-11-25T17%3a09%3a31.8122954Z&sv=2019-02-02&spr=https%2Chttp&st=2019-11-24T17%3A09%3A31Z&se=2019-11-26T17%3A09%3A31Z&sip=0.0.0.0-255.255.255.255&skoid=c4f48289-bb84-4086-b250-6f94a8f64cee&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2019-11-24T17%3A09%3A31Z&ske=2019-11-26T17%3A09%3A31Z&sks=b&skv=2019-02-02&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "5671c3f6-b71e-413d-a4a4-09cb0d167615" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 25 Nov 2019 17:09:32 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "cache", + "ETag" : "0x8D771CA3D04AA2E", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Mon, 25 Nov 2019 17:09:31 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d921dd64-401e-0028-78b3-a3f393000000", + "Body" : "default", + "x-ms-client-request-id" : "5671c3f6-b71e-413d-a4a4-09cb0d167615", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshotuserdelegation03840477362e2e/javablobnetworktestblobsnapshotuserdelegation120014caa048?snapshot=2019-11-25T17%3a09%3a31.8122954Z&sv=2019-02-02&spr=https%2Chttp&st=2019-11-24T17%3A09%3A31Z&se=2019-11-26T17%3A09%3A31Z&sip=0.0.0.0-255.255.255.255&skoid=c4f48289-bb84-4086-b250-6f94a8f64cee&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2019-11-24T17%3A09%3A31Z&ske=2019-11-26T17%3A09%3A31Z&sks=b&skv=2019-02-02&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "9b7b789f-1d56-4420-82a7-e0bc5b77894c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 25 Nov 2019 17:09:32 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Cache-Control" : "cache", + "ETag" : "0x8D771CA3D04AA2E", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Mon, 25 Nov 2019 17:09:31 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "329a24ef-a01e-0020-6db3-a3e99c000000", + "x-ms-client-request-id" : "9b7b789f-1d56-4420-82a7-e0bc5b77894c", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcnetworktestblobsnapshotuserdelegation&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "6d37055a-8740-4595-ab9e-550797ac321c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d921dd69-401e-0028-7cb3-a3f393000000", + "Body" : "jtcnetworktestblobsnapshotuserdelegationjtcnetworktestblobsnapshotuserdelegation03840477362e2eMon, 25 Nov 2019 17:09:31 GMT\"0x8D771CA3CF78BD8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:32 GMT", + "x-ms-client-request-id" : "6d37055a-8740-4595-ab9e-550797ac321c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobsnapshotuserdelegation03840477362e2e?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "2ca2d15f-5d48-46bb-8a61-3aa7b451d190" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "329a24f5-a01e-0020-70b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:32 GMT", + "x-ms-client-request-id" : "2ca2d15f-5d48-46bb-8a61-3aa7b451d190" + }, + "Exception" : null + } ], + "variables" : [ "jtcnetworktestblobsnapshotuserdelegation03840477362e2e", "javablobnetworktestblobsnapshotuserdelegation120014caa048", "2019-11-25T17:09:31.787683Z", "2019-11-25T17:09:31.788682900Z", "2019-11-25T17:09:31.789653800Z", "2019-11-25T17:09:31.789653800Z", "c4f48289-bb84-4086-b250-6f94a8f64cee", "72f988bf-86f1-41af-91ab-2d7cd011db47" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestblobuserdelegation.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestblobuserdelegation.json new file mode 100644 index 000000000000..15edff51784b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestblobuserdelegation.json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobuserdelegation0458840195b4321c51?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "ed069f9e-50c5-4566-9845-5fff88ef61ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3B4336A9", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d921dcfe-401e-0028-23b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:27 GMT", + "x-ms-client-request-id" : "ed069f9e-50c5-4566-9845-5fff88ef61ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobuserdelegation0458840195b4321c51/javablobnetworktestblobuserdelegation180269895b752a25", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "cc07b576-618a-45eb-9a32-54e5d2ba46ba", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3B509169", + "Content-Length" : "0", + "x-ms-request-id" : "329a2417-a01e-0020-28b3-a3e99c000000", + "x-ms-client-request-id" : "cc07b576-618a-45eb-9a32-54e5d2ba46ba" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://gapradev.blob.core.windows.net?restype=service&comp=userdelegationkey", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "d666dfef-2455-41b2-bb8a-102b544c9fc6", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d921dd0c-401e-0028-2db3-a3f393000000", + "Body" : "f2aa5e42-6670-410b-9f46-f8b1188ec239315a5043-2e30-41b6-b0d7-aa22296ae15d2019-11-24T17:09:28Z2019-11-26T17:09:28Zb2019-02-02UkVEQUNURUQ=", + "Date" : "Mon, 25 Nov 2019 17:09:29 GMT", + "x-ms-client-request-id" : "d666dfef-2455-41b2-bb8a-102b544c9fc6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobuserdelegation0458840195b4321c51/javablobnetworktestblobuserdelegation180269895b752a25?sv=2019-02-02&spr=https%2Chttp&st=2019-11-24T17%3A09%3A28Z&se=2019-11-26T17%3A09%3A28Z&sip=0.0.0.0-255.255.255.255&skoid=c4f48289-bb84-4086-b250-6f94a8f64cee&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2019-11-24T17%3A09%3A28Z&ske=2019-11-26T17%3A09%3A28Z&sks=b&skv=2019-02-02&sr=b&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "f8a58b97-5ac5-40c6-8324-138488a8ddb3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 25 Nov 2019 17:09:29 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "cache", + "ETag" : "0x8D771CA3B509169", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Mon, 25 Nov 2019 17:09:28 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "329a243b-a01e-0020-48b3-a3e99c000000", + "Body" : "default", + "x-ms-client-request-id" : "f8a58b97-5ac5-40c6-8324-138488a8ddb3", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobuserdelegation0458840195b4321c51/javablobnetworktestblobuserdelegation180269895b752a25?sv=2019-02-02&spr=https%2Chttp&st=2019-11-24T17%3A09%3A28Z&se=2019-11-26T17%3A09%3A28Z&sip=0.0.0.0-255.255.255.255&skoid=c4f48289-bb84-4086-b250-6f94a8f64cee&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2019-11-24T17%3A09%3A28Z&ske=2019-11-26T17%3A09%3A28Z&sks=b&skv=2019-02-02&sr=b&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "72266b1d-c83c-4826-ae6c-b05b38654242" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 25 Nov 2019 17:09:29 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Cache-Control" : "cache", + "ETag" : "0x8D771CA3B509169", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Mon, 25 Nov 2019 17:09:28 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "d921dd21-401e-0028-3fb3-a3f393000000", + "x-ms-client-request-id" : "72266b1d-c83c-4826-ae6c-b05b38654242", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcnetworktestblobuserdelegation&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "cda29162-14f6-4a3b-bbce-e3c5b70987c7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a24ae-a01e-0020-3ab3-a3e99c000000", + "Body" : "jtcnetworktestblobuserdelegationjtcnetworktestblobuserdelegation0458840195b4321c51Mon, 25 Nov 2019 17:09:28 GMT\"0x8D771CA3B4336A9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:29 GMT", + "x-ms-client-request-id" : "cda29162-14f6-4a3b-bbce-e3c5b70987c7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestblobuserdelegation0458840195b4321c51?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "882b754a-ef49-4235-a37d-d69f821976b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "d921dd23-401e-0028-40b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:29 GMT", + "x-ms-client-request-id" : "882b754a-ef49-4235-a37d-d69f821976b5" + }, + "Exception" : null + } ], + "variables" : [ "jtcnetworktestblobuserdelegation0458840195b4321c51", "javablobnetworktestblobuserdelegation180269895b752a25", "2019-11-25T17:09:28.843991800Z", "2019-11-25T17:09:28.843991800Z", "2019-11-25T17:09:28.883984400Z", "2019-11-25T17:09:28.883984400Z", "c4f48289-bb84-4086-b250-6f94a8f64cee", "72f988bf-86f1-41af-91ab-2d7cd011db47" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestcontaineruserdelegation.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestcontaineruserdelegation.json new file mode 100644 index 000000000000..51eee75a70c9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsnetworktestcontaineruserdelegation.json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestcontaineruserdelegation0715539637c65f78?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "2faa7c3f-2353-404d-9872-fc7ff279003a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3D969CD1", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "d921dd71-401e-0028-04b3-a3f393000000", + "Date" : "Mon, 25 Nov 2019 17:09:32 GMT", + "x-ms-client-request-id" : "2faa7c3f-2353-404d-9872-fc7ff279003a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestcontaineruserdelegation0715539637c65f78/javablobnetworktestcontaineruserdelegation1670526fc60bd", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "ce8a9607-60fb-44ea-ad46-c3424eb65e76", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3DA4BACC", + "Content-Length" : "0", + "x-ms-request-id" : "329a24f6-a01e-0020-71b3-a3e99c000000", + "x-ms-client-request-id" : "ce8a9607-60fb-44ea-ad46-c3424eb65e76" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://gapradev.blob.core.windows.net?restype=service&comp=userdelegationkey", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "756cdd31-d044-4410-95f5-03d770ce4703", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d921dd82-401e-0028-11b3-a3f393000000", + "Body" : "c08759dd-0fce-4f53-969f-3ed0c1a66f2806bd9169-60ce-4847-a2a3-30749ad2b8382019-11-24T17:09:32Z2019-11-26T17:09:32Zb2019-02-02UkVEQUNURUQ=", + "Date" : "Mon, 25 Nov 2019 17:09:33 GMT", + "x-ms-client-request-id" : "756cdd31-d044-4410-95f5-03d770ce4703", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestcontaineruserdelegation0715539637c65f78?include=&restype=container&comp=list&sv=2019-02-02&se=2019-11-26T17%3A09%3A32Z&skoid=c4f48289-bb84-4086-b250-6f94a8f64cee&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2019-11-24T17%3A09%3A32Z&ske=2019-11-26T17%3A09%3A32Z&sks=b&skv=2019-02-02&sr=c&sp=racwdl&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "9d5e9ed0-76a8-4f49-9fa6-50e168a93d11" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a24fd-a01e-0020-76b3-a3e99c000000", + "Body" : "javablobnetworktestcontaineruserdelegation1670526fc60bdMon, 25 Nov 2019 17:09:32 GMTMon, 25 Nov 2019 17:09:32 GMT0x8D771CA3DA4BACC7application/octet-streamwh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue", + "Date" : "Mon, 25 Nov 2019 17:09:33 GMT", + "x-ms-client-request-id" : "9d5e9ed0-76a8-4f49-9fa6-50e168a93d11", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcnetworktestcontaineruserdelegation&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "cc6b24df-eae3-457d-a128-d044b2d0dcc0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d921dd8c-401e-0028-1ab3-a3f393000000", + "Body" : "jtcnetworktestcontaineruserdelegationjtcnetworktestcontaineruserdelegation0715539637c65f78Mon, 25 Nov 2019 17:09:32 GMT\"0x8D771CA3D969CD1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:33 GMT", + "x-ms-client-request-id" : "cc6b24df-eae3-457d-a128-d044b2d0dcc0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcnetworktestcontaineruserdelegation0715539637c65f78?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "6f3c150e-1e30-4347-bb7c-de8cb5807760" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "329a24ff-a01e-0020-77b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:33 GMT", + "x-ms-client-request-id" : "6f3c150e-1e30-4347-bb7c-de8cb5807760" + }, + "Exception" : null + } ], + "variables" : [ "jtcnetworktestcontaineruserdelegation0715539637c65f78", "javablobnetworktestcontaineruserdelegation1670526fc60bd", "2019-11-25T17:09:32.746616Z", "2019-11-25T17:09:32.747615500Z", "2019-11-25T17:09:32.747615500Z", "c4f48289-bb84-4086-b250-6f94a8f64cee", "72f988bf-86f1-41af-91ab-2d7cd011db47" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsservicesassignaturevaluesnetworktestcontainer.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsservicesassignaturevaluesnetworktestcontainer.json new file mode 100644 index 000000000000..7f79fea04c1f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SasClientTestsservicesassignaturevaluesnetworktestcontainer.json @@ -0,0 +1,154 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0249587958?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "f6512891-e5f8-47d1-9485-8fcf7c48fa5e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3AE1C274", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "329a23fd-a01e-0020-13b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:27 GMT", + "x-ms-client-request-id" : "f6512891-e5f8-47d1-9485-8fcf7c48fa5e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0249587958/javablobservicesassignaturevaluesnetworktestcontainer113162b5", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "611f938d-968f-4a91-864a-fc9bb862e9a7", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 25 Nov 2019 17:09:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "0x8D771CA3AEF5E57", + "Content-Length" : "0", + "x-ms-request-id" : "d921dced-401e-0028-14b3-a3f393000000", + "x-ms-client-request-id" : "611f938d-968f-4a91-864a-fc9bb862e9a7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0249587958?restype=container&comp=acl", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "22080f30-20b6-4858-9d77-545a366c2404", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "0x8D771CA3B001454", + "Last-Modified" : "Mon, 25 Nov 2019 17:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a2402-a01e-0020-17b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:27 GMT", + "x-ms-client-request-id" : "22080f30-20b6-4858-9d77-545a366c2404" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0249587958?include=&restype=container&comp=list&sv=2019-02-02&si=0000&sr=c&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "3d64c283-d111-457b-8969-6214cae106f3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d921dcf0-401e-0028-17b3-a3f393000000", + "Body" : "javablobservicesassignaturevaluesnetworktestcontainer113162b5Mon, 25 Nov 2019 17:09:28 GMTMon, 25 Nov 2019 17:09:28 GMT0x8D771CA3AEF5E577application/octet-streamwh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue", + "Date" : "Mon, 25 Nov 2019 17:09:27 GMT", + "x-ms-client-request-id" : "3d64c283-d111-457b-8969-6214cae106f3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0249587958?include=&restype=container&comp=list&sv=2019-02-02&se=2019-11-26T17%3A09%3A28Z&sr=c&sp=racwdl&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "1275df9c-6fe2-4bf2-b5ce-5da41aaf40da" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "329a240b-a01e-0020-1eb3-a3e99c000000", + "Body" : "javablobservicesassignaturevaluesnetworktestcontainer113162b5Mon, 25 Nov 2019 17:09:28 GMTMon, 25 Nov 2019 17:09:28 GMT0x8D771CA3AEF5E577application/octet-streamwh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue", + "Date" : "Mon, 25 Nov 2019 17:09:27 GMT", + "x-ms-client-request-id" : "1275df9c-6fe2-4bf2-b5ce-5da41aaf40da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestcontainer&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "8cd3bd90-4d5c-467b-8fca-74f903153378" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "d921dcf8-401e-0028-1db3-a3f393000000", + "Body" : "jtcservicesassignaturevaluesnetworktestcontainerjtcservicesassignaturevaluesnetworktestcontainer0249587958Mon, 25 Nov 2019 17:09:28 GMT\"0x8D771CA3B001454\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 25 Nov 2019 17:09:27 GMT", + "x-ms-client-request-id" : "8cd3bd90-4d5c-467b-8fca-74f903153378", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0249587958?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.1.0-beta.1 11.0.4; Windows 10 10.0", + "x-ms-client-request-id" : "71a3b729-6bef-4c5a-bf74-aefe7470d858" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "329a240f-a01e-0020-22b3-a3e99c000000", + "Date" : "Mon, 25 Nov 2019 17:09:27 GMT", + "x-ms-client-request-id" : "71a3b729-6bef-4c5a-bf74-aefe7470d858" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestcontainer0249587958", "javablobservicesassignaturevaluesnetworktestcontainer113162b5", "2019-11-25T17:09:28.210051100Z", "2019-11-25T17:09:28.315019800Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-common/CHANGELOG.md b/sdk/storage/azure-storage-common/CHANGELOG.md index 48fd6dab82e5..8a167f5c9673 100644 --- a/sdk/storage/azure-storage-common/CHANGELOG.md +++ b/sdk/storage/azure-storage-common/CHANGELOG.md @@ -1,4 +1,8 @@ # Release History + +## Version XX.X.X (XXXX-XX-XX) +- Added generateSas methods on service clients to improve discoverability and convenience of sas. Deprecated setters of required parameters, generateSasQueryParameters methods on AccountSasSignatureValues to direct users to using the methods added on clients. + ## Version 12.1.0 (2019-12-04) - Upgraded to version 1.1.0 of Azure Core. diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/AccountSasImplUtil.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/AccountSasImplUtil.java new file mode 100644 index 000000000000..2f2060ba5fc0 --- /dev/null +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/AccountSasImplUtil.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.common.implementation; + +import com.azure.core.util.CoreUtils; +import com.azure.storage.common.StorageSharedKeyCredential; +import com.azure.storage.common.sas.AccountSasPermission; +import com.azure.storage.common.sas.AccountSasSignatureValues; +import com.azure.storage.common.sas.SasIpRange; +import com.azure.storage.common.sas.SasProtocol; + +import java.time.OffsetDateTime; + +import static com.azure.storage.common.implementation.SasImplUtils.formatQueryParameterDate; +import static com.azure.storage.common.implementation.SasImplUtils.tryAppendQueryParameter; + +/** + * This class provides helper methods for common account sas patterns. + * + * RESERVED FOR INTERNAL USE. + */ +public class AccountSasImplUtil { + + private String version; + + private SasProtocol protocol; + + private OffsetDateTime startTime; + + private OffsetDateTime expiryTime; + + private String permissions; + + private SasIpRange sasIpRange; + + private String services; + + private String resourceTypes; + + /** + * Creates a new {@link AccountSasImplUtil} with the specified parameters + * + * @param sasValues {@link AccountSasSignatureValues} + */ + public AccountSasImplUtil(AccountSasSignatureValues sasValues) { + this.version = sasValues.getVersion(); + this.protocol = sasValues.getProtocol(); + this.startTime = sasValues.getStartTime(); + this.expiryTime = sasValues.getExpiryTime(); + this.permissions = sasValues.getPermissions(); + this.sasIpRange = sasValues.getSasIpRange(); + this.services = sasValues.getServices(); + this.resourceTypes = sasValues.getResourceTypes(); + } + + /** + * Generates a Sas signed with a {@link StorageSharedKeyCredential} + * + * @param storageSharedKeyCredentials {@link StorageSharedKeyCredential} + * @return A String representing the Sas + */ + public String generateSas(StorageSharedKeyCredential storageSharedKeyCredentials) { + StorageImplUtils.assertNotNull("storageSharedKeyCredentials", storageSharedKeyCredentials); + StorageImplUtils.assertNotNull("services", this.services); + StorageImplUtils.assertNotNull("resourceTypes", this.resourceTypes); + StorageImplUtils.assertNotNull("expiryTime", this.expiryTime); + StorageImplUtils.assertNotNull("permissions", this.permissions); + + if (CoreUtils.isNullOrEmpty(version)) { + version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; + } + + // Signature is generated on the un-url-encoded values. + String signature = storageSharedKeyCredentials.computeHmac256(stringToSign(storageSharedKeyCredentials)); + + return encode(signature); + } + + private String stringToSign(final StorageSharedKeyCredential storageSharedKeyCredentials) { + return String.join("\n", + storageSharedKeyCredentials.getAccountName(), + AccountSasPermission.parse(this.permissions).toString(), // guarantees ordering + this.services, + resourceTypes, + this.startTime == null ? "" : Constants.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), + Constants.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), + this.sasIpRange == null ? "" : this.sasIpRange.toString(), + this.protocol == null ? "" : this.protocol.toString(), + this.version, + "" // Account SAS requires an additional newline character + ); + } + + private String encode(String signature) { + /* + We should be url-encoding each key and each value, but because we know all the keys and values will encode to + themselves, we cheat except for the signature value. + */ + StringBuilder sb = new StringBuilder(); + + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SERVICE_VERSION, this.version); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SERVICES, this.services); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_RESOURCES_TYPES, this.resourceTypes); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_PROTOCOL, this.protocol); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_START_TIME, formatQueryParameterDate(this.startTime)); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_EXPIRY_TIME, formatQueryParameterDate(this.expiryTime)); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_IP_RANGE, this.sasIpRange); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_PERMISSIONS, this.permissions); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNATURE, signature); + + return sb.toString(); + } +} diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/SasImplUtils.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/SasImplUtils.java new file mode 100644 index 000000000000..a6dc9e2af731 --- /dev/null +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/SasImplUtils.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.common.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.storage.common.StorageSharedKeyCredential; +import com.azure.storage.common.Utility; +import com.azure.storage.common.policy.StorageSharedKeyCredentialPolicy; + +import java.time.OffsetDateTime; + +/** + * This class provides helper methods for sas. + * + * RESERVED FOR INTERNAL USE. + */ +public class SasImplUtils { + /** + * Extracts the {@link StorageSharedKeyCredential} from a {@link HttpPipeline} + * @param pipeline {@link HttpPipeline} + * @return a {@link StorageSharedKeyCredential} + */ + public static StorageSharedKeyCredential extractSharedKeyCredential(HttpPipeline pipeline) { + for (int i = 0; i < pipeline.getPolicyCount(); i++) { + if (pipeline.getPolicy(i) instanceof StorageSharedKeyCredentialPolicy) { + StorageSharedKeyCredentialPolicy policy = (StorageSharedKeyCredentialPolicy) pipeline.getPolicy(i); + return policy.sharedKeyCredential(); + } + } + return null; + } + + /** + * Shared helper method to append a SAS query parameter. + * + * @param sb The {@code StringBuilder} to append to. + * @param param The {@code String} parameter to append. + * @param value The value of the parameter to append. + */ + public static void tryAppendQueryParameter(StringBuilder sb, String param, Object value) { + if (value != null) { + if (sb.length() != 0) { + sb.append('&'); + } + sb.append(Utility.urlEncode(param)).append('=').append(Utility.urlEncode(value.toString())); + } + } + + /** + * Formats date time SAS query parameters. + * + * @param dateTime The SAS date time. + * @return A String representing the SAS date time. + */ + public static String formatQueryParameterDate(OffsetDateTime dateTime) { + if (dateTime == null) { + return null; + } else { + return Constants.ISO_8601_UTC_DATE_FORMATTER.format(dateTime); + } + } +} diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/StorageImplUtils.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/StorageImplUtils.java index 14b9cb584589..605c74c5dc9b 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/StorageImplUtils.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/StorageImplUtils.java @@ -18,6 +18,7 @@ import java.util.Map; import java.util.TreeMap; import java.util.function.Function; + import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasPermission.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasPermission.java index 609db4b013ce..b7fcbb2104e6 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasPermission.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasPermission.java @@ -11,7 +11,7 @@ * This is a helper class to construct a string representing the permissions granted by an Account SAS. Setting a value * to true means that any SAS which uses these permissions will grant permissions for that operation. Once all the * values are set, this should be serialized with toString and set as the permissions field on - * {@link AccountSasSignatureValues#setPermissions(AccountSasPermission) AccountSasSignatureValues}. + * {@link AccountSasSignatureValues AccountSasSignatureValues}. * *

* It is possible to construct the permissions string without this class, but the order of the permissions is particular diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasQueryParameters.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasQueryParameters.java index 37093937b409..05379804e6a1 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasQueryParameters.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasQueryParameters.java @@ -14,7 +14,10 @@ * appended to a URL directly (though caution should be taken here in case there are existing query parameters, which * might affect the appropriate means of appending these query parameters). NOTE: Instances of this class are immutable * to ensure thread safety. + * @deprecated Please use the generateSas method on the desired service client after initializing + * {@link AccountSasSignatureValues}. */ +@Deprecated public final class AccountSasQueryParameters extends BaseSasQueryParameters { private final String services; @@ -27,7 +30,9 @@ public final class AccountSasQueryParameters extends BaseSasQueryParameters { * @param queryParamsMap All query parameters for the request as key-value pairs * @param removeSasParameters When {@code true}, the SAS query parameters will be removed from * queryParamsMap + * @deprecated Please use {@link AccountSasSignatureValues} */ + @Deprecated AccountSasQueryParameters(Map queryParamsMap, boolean removeSasParameters) { super(queryParamsMap, removeSasParameters); this.resourceTypes = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_RESOURCES_TYPES, @@ -51,7 +56,9 @@ public final class AccountSasQueryParameters extends BaseSasQueryParameters { * {@code null}. * @param permissions A {@code String} representing the storage permissions or {@code null}. * @param signature A {@code String} representing the signature for the SAS token. + * @deprecated Please use {@link AccountSasSignatureValues} */ + @Deprecated AccountSasQueryParameters(String version, String services, String resourceTypes, SasProtocol protocol, OffsetDateTime startTime, OffsetDateTime expiryTime, SasIpRange sasIpRange, String permissions, String signature) { @@ -63,7 +70,9 @@ public final class AccountSasQueryParameters extends BaseSasQueryParameters { /** * @return The storage services being accessed (only for Account SAS). Please refer to {@link AccountSasService} for * more details. + * @deprecated Please use {@link AccountSasSignatureValues} */ + @Deprecated public String getServices() { return services; } @@ -71,7 +80,9 @@ public String getServices() { /** * @return The storage resource types being accessed (only for Account SAS). Please refer to {@link * AccountSasResourceType} for more details. + * @deprecated Please use {@link AccountSasSignatureValues} */ + @Deprecated public String getResourceTypes() { return resourceTypes; } @@ -80,7 +91,10 @@ public String getResourceTypes() { * Encodes all SAS query parameters into a string that can be appended to a URL. * * @return A {@code String} representing all SAS query parameters. + * @deprecated Please use the generateSas method on the desired service client after initializing + * {@link AccountSasSignatureValues}. */ + @Deprecated public String encode() { /* We should be url-encoding each key and each value, but because we know all the keys and values will encode to diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasSignatureValues.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasSignatureValues.java index 240d253e3632..9cfff06b1ed4 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasSignatureValues.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/AccountSasSignatureValues.java @@ -11,19 +11,12 @@ import java.time.OffsetDateTime; /** - * Used to generate a Shared Access Signature (SAS) for an Azure Storage account. Once all the values are set, call - * {@link - * #generateSasQueryParameters(StorageSharedKeyCredential) generateSASQueryParameters(StorageSharedKeyCredential)} to - * obtain a representation of the SAS which can actually be applied to container, file, queue, and tables. - * - *

Generating an account SAS

- *

The snippet below generates an account SAS that lasts for two days and gives the user read and list access to - * blob containers and file shares.

- * - * {@codesnippet com.azure.storage.common.sas.accountSasSignatureValues.generateSasQueryParameters#StorageSharedKeyCredential} + * Used to initialize parameters for a Shared Access Signature (SAS) for an Azure Storage account. Once all the + * values here are set, use the generateSas method on the desired service client to obtain a representation of the SAS + * which can then be applied to a new client using the .sasToken(String) method on the desired client builder. * + * @see Storage SAS overview * @see Create an account SAS - * @see Storage SAS overview */ public final class AccountSasSignatureValues { private String version; @@ -44,10 +37,33 @@ public final class AccountSasSignatureValues { /** * Initializes a new {@link AccountSasSignatureValues} object. + * @deprecated Please use {@link #AccountSasSignatureValues(OffsetDateTime, AccountSasPermission, AccountSasService, + * AccountSasResourceType)} */ + @Deprecated public AccountSasSignatureValues() { } + /** + * Initializes a new {@link AccountSasSignatureValues} object. + * @param expiryTime The time after which the SAS will no longer work. + * @param permissions {@link AccountSasPermission} allowed by the SAS. + * @param services {@link AccountSasService} targeted by the SAS. + * @param resourceTypes {@link AccountSasResourceType} targeted by the SAS. + */ + public AccountSasSignatureValues(OffsetDateTime expiryTime, AccountSasPermission permissions, + AccountSasService services, AccountSasResourceType resourceTypes) { + StorageImplUtils.assertNotNull("expiryTime", expiryTime); + StorageImplUtils.assertNotNull("services", services); + StorageImplUtils.assertNotNull("permissions", permissions); + StorageImplUtils.assertNotNull("resourceTypes", resourceTypes); + + this.expiryTime = expiryTime; + this.services = services.toString(); + this.resourceTypes = resourceTypes.toString(); + this.permissions = permissions.toString(); + } + /** * * @return the service version that is targeted, if {@code null} or empty the latest service version targeted by the @@ -117,7 +133,10 @@ public OffsetDateTime getExpiryTime() { * * @param expiryTime Expiry time to set * @return the updated AccountSasSignatureValues object. + * @deprecated Please use {@link #AccountSasSignatureValues(OffsetDateTime, AccountSasPermission, AccountSasService, + * AccountSasResourceType)} to specify the expiry time. */ + @Deprecated public AccountSasSignatureValues setExpiryTime(OffsetDateTime expiryTime) { this.expiryTime = expiryTime; return this; @@ -140,7 +159,10 @@ public String getPermissions() { * @param permissions Permissions to set. * @return the updated AccountSasSignatureValues object. * @throws NullPointerException if {@code permissions} is null. + * @deprecated Please use {@link #AccountSasSignatureValues(OffsetDateTime, AccountSasPermission, AccountSasService, + * AccountSasResourceType)} to specify the allowed permissions. */ + @Deprecated public AccountSasSignatureValues setPermissions(AccountSasPermission permissions) { StorageImplUtils.assertNotNull("permissions", permissions); this.permissions = permissions.toString(); @@ -178,7 +200,10 @@ public String getServices() { * * @param services Allowed services string to set * @return the updated AccountSasSignatureValues object. + * @deprecated Please use {@link #AccountSasSignatureValues(OffsetDateTime, AccountSasPermission, AccountSasService, + * AccountSasResourceType)} to specify the services being targeted. */ + @Deprecated public AccountSasSignatureValues setServices(String services) { this.services = services; return this; @@ -198,7 +223,10 @@ public String getResourceTypes() { * * @param resourceTypes Allowed resource types string to set * @return the updated AccountSasSignatureValues object. + * @deprecated Please use {@link #AccountSasSignatureValues(OffsetDateTime, AccountSasPermission, AccountSasService, + * AccountSasResourceType)} to specify the resource types being targeted. */ + @Deprecated public AccountSasSignatureValues setResourceTypes(String resourceTypes) { this.resourceTypes = resourceTypes; return this; @@ -232,7 +260,10 @@ public AccountSasSignatureValues setResourceTypes(String resourceTypes) { * @throws RuntimeException If the HMAC-SHA256 signature for {@code storageSharedKeyCredentials} fails to generate. * @throws NullPointerException If any of {@code storageSharedKeyCredentials}, {@code services}, * {@code resourceTypes}, {@code expiryTime}, or {@code permissions} is null. + * @deprecated Please use the generateAccountSas(AccountSasSignatureValues) method on the desired service client + * after initializing {@link AccountSasSignatureValues}. */ + @Deprecated public AccountSasQueryParameters generateSasQueryParameters( StorageSharedKeyCredential storageSharedKeyCredentials) { StorageImplUtils.assertNotNull("storageSharedKeyCredentials", storageSharedKeyCredentials); diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/BaseSasQueryParameters.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/BaseSasQueryParameters.java index 648faf156554..d921afe1a8c1 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/BaseSasQueryParameters.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/BaseSasQueryParameters.java @@ -6,6 +6,8 @@ import com.azure.storage.common.Utility; import com.azure.storage.common.implementation.Constants; +import com.azure.storage.common.implementation.SasImplUtils; + import java.time.OffsetDateTime; import java.util.Map; import java.util.function.Function; @@ -16,7 +18,10 @@ * object to be constructed as part of a URL or it can be encoded into a {@code String} and appended to a URL directly * (though caution should be taken here in case there are existing query parameters, which might affect the appropriate * means of appending these query parameters). NOTE: Instances of this class are immutable to ensure thread safety. + * @deprecated Please use the generateSas method on the desired client after initializing the appropriate + * SasSignatureValues object. */ +@Deprecated public abstract class BaseSasQueryParameters { protected String version; @@ -39,7 +44,9 @@ public abstract class BaseSasQueryParameters { * @param queryParamsMap All query parameters for the request as key-value pairs * @param removeSASParametersFromMap When {@code true}, the SAS query parameters will be removed from * queryParamsMap + * @deprecated Please use SasSignatureValues */ + @Deprecated public BaseSasQueryParameters(Map queryParamsMap, boolean removeSASParametersFromMap) { this.version = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SERVICE_VERSION, removeSASParametersFromMap); @@ -64,7 +71,9 @@ public BaseSasQueryParameters(Map queryParamsMap, boolean remo * @param name The name of parameter to find. * @param remove Whether or not to remove the parameter from the map. * @return A String representing the query parameter + * @deprecated Please use SasSignatureValues */ + @Deprecated protected String getQueryParameter(Map parameters, String name, boolean remove) { return getQueryParameter(parameters, name, remove, value -> value); } @@ -78,7 +87,9 @@ protected String getQueryParameter(Map parameters, String name * @param remove Whether or not to remove the parameter from the map. * @param converter Function that transforms the value to a String. * @return The object + * @deprecated Please use SasSignatureValues */ + @Deprecated protected T getQueryParameter(Map parameters, String name, boolean remove, Function converter) { String[] parameterValue = parameters.get(name); @@ -105,7 +116,9 @@ protected T getQueryParameter(Map parameters, String name, * {@code null}. * @param permissions A {@code String} representing the storage permissions or {@code null}. * @param signature A {@code String} representing the signature for the SAS token. + * @deprecated Please use SasSignatureValues */ + @Deprecated public BaseSasQueryParameters(String version, SasProtocol protocol, OffsetDateTime startTime, OffsetDateTime expiryTime, SasIpRange sasIpRange, String permissions, String signature) { this.version = version; @@ -119,49 +132,63 @@ public BaseSasQueryParameters(String version, SasProtocol protocol, OffsetDateTi /** * @return The storage version + * @deprecated Please use SasSignatureValues */ + @Deprecated public String getVersion() { return version; } /** * @return The allowed HTTP protocol(s) or {@code null}. Please refer to {@link SasProtocol} for more details. + * @deprecated Please use SasSignatureValues */ + @Deprecated public SasProtocol getProtocol() { return protocol; } /** * @return The start time for this SAS token or {@code null}. + * @deprecated Please use SasSignatureValues */ + @Deprecated public OffsetDateTime getStartTime() { return startTime; } /** * @return The expiry time for this SAS token. + * @deprecated Please use SasSignatureValues */ + @Deprecated public OffsetDateTime getExpiryTime() { return expiryTime; } /** * @return {@link SasIpRange} + * @deprecated Please use SasSignatureValues */ + @Deprecated public SasIpRange getSasIpRange() { return sasIpRange; } /** * @return Please refer to *SASPermission classes for more details. + * @deprecated Please use SasSignatureValues */ + @Deprecated public String getPermissions() { return permissions; } /** * @return The signature for the SAS token. + * @deprecated Please use SasSignatureValues */ + @Deprecated public String getSignature() { return signature; } @@ -172,14 +199,11 @@ public String getSignature() { * @param sb The {@code StringBuilder} to append to. * @param param The {@code String} parameter to append. * @param value The value of the parameter to append. + * @deprecated Please use SasSignatureValues */ + @Deprecated protected void tryAppendQueryParameter(StringBuilder sb, String param, Object value) { - if (value != null) { - if (sb.length() != 0) { - sb.append('&'); - } - sb.append(Utility.urlEncode(param)).append('=').append(Utility.urlEncode(value.toString())); - } + SasImplUtils.tryAppendQueryParameter(sb, param, value); } /** @@ -187,19 +211,20 @@ protected void tryAppendQueryParameter(StringBuilder sb, String param, Object va * * @param dateTime The SAS date time. * @return A String representing the SAS date time. + * @deprecated Please use SasSignatureValues */ + @Deprecated protected String formatQueryParameterDate(OffsetDateTime dateTime) { - if (dateTime == null) { - return null; - } else { - return Constants.ISO_8601_UTC_DATE_FORMATTER.format(dateTime); - } + return SasImplUtils.formatQueryParameterDate(dateTime); } /** * Encodes all SAS query parameters into a string that can be appended to a URL. * * @return A {@code String} representing all SAS query parameters. + * @deprecated Please use the generateSas method on the desired client after initializing the appropriate + * SasSignatureValues object. */ + @Deprecated public abstract String encode(); } diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/CommonSasQueryParameters.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/CommonSasQueryParameters.java index e40571a343fe..d894d1f16cb7 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/CommonSasQueryParameters.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/sas/CommonSasQueryParameters.java @@ -5,16 +5,32 @@ import com.azure.storage.common.Utility; import com.azure.storage.common.implementation.Constants; +import com.azure.storage.common.implementation.SasImplUtils; import java.time.OffsetDateTime; import java.util.Map; +import java.util.function.Function; /** * Represents the components that make up an Azure Storage SAS' query parameters. This type is not constructed directly * by the user; it is only generated by the URLParts type. NOTE: Instances of this class are immutable to ensure thread * safety. */ -public class CommonSasQueryParameters extends BaseSasQueryParameters { +public class CommonSasQueryParameters { + + private final String version; + + private final SasProtocol protocol; + + private final OffsetDateTime startTime; + + private final OffsetDateTime expiryTime; + + private final SasIpRange sasIpRange; + + private final String permissions; + + private final String signature; private final String services; @@ -47,14 +63,27 @@ public class CommonSasQueryParameters extends BaseSasQueryParameters { private final String contentType; /** - * Creates a new {@link AccountSasQueryParameters} object. + * Creates a new {@link CommonSasQueryParameters} object. * * @param queryParamsMap All query parameters for the request as key-value pairs * @param removeSasParametersFromMap When {@code true}, the SAS query parameters will be removed from * queryParamsMap */ public CommonSasQueryParameters(Map queryParamsMap, boolean removeSasParametersFromMap) { - super(queryParamsMap, removeSasParametersFromMap); + this.version = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SERVICE_VERSION, + removeSasParametersFromMap); + this.protocol = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_PROTOCOL, + removeSasParametersFromMap, SasProtocol::parse); + this.startTime = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_START_TIME, + removeSasParametersFromMap, Utility::parseDate); + this.expiryTime = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_EXPIRY_TIME, + removeSasParametersFromMap, Utility::parseDate); + this.sasIpRange = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_IP_RANGE, + removeSasParametersFromMap, SasIpRange::parse); + this.permissions = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_PERMISSIONS, + removeSasParametersFromMap); + this.signature = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNATURE, + removeSasParametersFromMap); this.resourceTypes = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_RESOURCES_TYPES, removeSasParametersFromMap); this.services = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SERVICES, @@ -87,43 +116,86 @@ public CommonSasQueryParameters(Map queryParamsMap, boolean re removeSasParametersFromMap); } - @Override + /** + * Helper method to get a query parameter + * + * @param parameters A {@code Map} of parameters to values to search. + * @param name The name of parameter to find. + * @param remove Whether or not to remove the parameter from the map. + * @return A String representing the query parameter + */ + private String getQueryParameter(Map parameters, String name, boolean remove) { + return getQueryParameter(parameters, name, remove, value -> value); + } + + /** + * Helper method to get a query parameter + * + * @param The object type. + * @param parameters A {@code Map} of parameters to values to search. + * @param name The name of parameter to find. + * @param remove Whether or not to remove the parameter from the map. + * @param converter Function that transforms the value to a String. + * @return The object + */ + private T getQueryParameter(Map parameters, String name, boolean remove, Function converter) { + String[] parameterValue = parameters.get(name); + if (parameterValue == null) { + return null; + } + + if (remove) { + parameters.remove(name); + } + + return converter.apply(parameterValue[0]); + } + + /** + * Encodes all SAS query parameters into a string that can be appended to a URL. + * + * @return A {@code String} representing all SAS query parameters. + */ public String encode() { - /* + /* We should be url-encoding each key and each value, but because we know all the keys and values will encode to themselves, we cheat except for the signature value. */ StringBuilder sb = new StringBuilder(); // Common - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SERVICE_VERSION, this.version); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_PROTOCOL, this.protocol); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_START_TIME, formatQueryParameterDate(this.startTime)); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_EXPIRY_TIME, formatQueryParameterDate(this.expiryTime)); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_IP_RANGE, this.sasIpRange); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_PERMISSIONS, this.permissions); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNATURE, this.signature); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SERVICE_VERSION, this.version); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_PROTOCOL, this.protocol); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_START_TIME, + SasImplUtils.formatQueryParameterDate(this.startTime)); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_EXPIRY_TIME, + SasImplUtils.formatQueryParameterDate(this.expiryTime)); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_IP_RANGE, this.sasIpRange); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_PERMISSIONS, this.permissions); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNATURE, this.signature); // Account - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SERVICES, this.services); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_RESOURCES_TYPES, this.resourceTypes); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SERVICES, this.services); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_RESOURCES_TYPES, this.resourceTypes); // Services - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_IDENTIFIER, this.identifier); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_OBJECT_ID, this.keyObjectId); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_TENANT_ID, this.keyTenantId); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_START, - formatQueryParameterDate(this.keyStart)); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_EXPIRY, - formatQueryParameterDate(this.keyExpiry)); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_SERVICE, this.keyService); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_VERSION, this.keyVersion); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_RESOURCE, this.resource); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CACHE_CONTROL, this.cacheControl); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_DISPOSITION, this.contentDisposition); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_ENCODING, this.contentEncoding); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_LANGUAGE, this.contentLanguage); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_TYPE, this.contentType); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_IDENTIFIER, this.identifier); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_OBJECT_ID, this.keyObjectId); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_TENANT_ID, this.keyTenantId); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_START, + SasImplUtils.formatQueryParameterDate(this.keyStart)); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_EXPIRY, + SasImplUtils.formatQueryParameterDate(this.keyExpiry)); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_SERVICE, this.keyService); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_VERSION, this.keyVersion); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_RESOURCE, this.resource); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CACHE_CONTROL, this.cacheControl); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_DISPOSITION, + this.contentDisposition); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_ENCODING, this.contentEncoding); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_LANGUAGE, this.contentLanguage); + SasImplUtils.tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_TYPE, this.contentType); return sb.toString(); } @@ -235,4 +307,53 @@ public String getServices() { public String getResourceTypes() { return resourceTypes; } + + /** + * @return The storage version + */ + public String getVersion() { + return version; + } + + /** + * @return The allowed HTTP protocol(s) or {@code null}. Please refer to {@link SasProtocol} for more details. + */ + public SasProtocol getProtocol() { + return protocol; + } + + /** + * @return The start time for this SAS token or {@code null}. + */ + public OffsetDateTime getStartTime() { + return startTime; + } + + /** + * @return The expiry time for this SAS token. + */ + public OffsetDateTime getExpiryTime() { + return expiryTime; + } + + /** + * @return {@link SasIpRange} + */ + public SasIpRange getSasIpRange() { + return sasIpRange; + } + + /** + * @return Please refer to *SASPermission classes for more details. + */ + public String getPermissions() { + return permissions; + } + + /** + * @return The signature for the SAS token. + */ + public String getSignature() { + return signature; + } } diff --git a/sdk/storage/azure-storage-common/src/samples/java/com/azure/storage/common/sas/AccountSasSignatureValuesJavaDocCodeSnippets.java b/sdk/storage/azure-storage-common/src/samples/java/com/azure/storage/common/sas/AccountSasSignatureValuesJavaDocCodeSnippets.java deleted file mode 100644 index af33baca1953..000000000000 --- a/sdk/storage/azure-storage-common/src/samples/java/com/azure/storage/common/sas/AccountSasSignatureValuesJavaDocCodeSnippets.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.common.sas; - -import com.azure.storage.common.StorageSharedKeyCredential; - -import java.time.Duration; -import java.time.OffsetDateTime; - -/** - * Code snippets for {@link AccountSasSignatureValues}. - */ -public class AccountSasSignatureValuesJavaDocCodeSnippets { - public void generateSas() { - // BEGIN: com.azure.storage.common.sas.accountSasSignatureValues.generateSasQueryParameters#StorageSharedKeyCredential - StorageSharedKeyCredential credential = new StorageSharedKeyCredential("my-account", "my-key"); - - AccountSasPermission permissions = new AccountSasPermission() - .setListPermission(true) - .setReadPermission(true); - String resourceTypes = new AccountSasResourceType().setContainer(true).toString(); - String services = new AccountSasService().setBlobAccess(true).setFileAccess(true).toString(); - - // Creates an account SAS that can read and list from blob containers and file shares. - // The following are required: permissions, resourceTypes, services, and expiry date. - AccountSasQueryParameters sasQueryParameters = new AccountSasSignatureValues() - .setPermissions(permissions) - .setResourceTypes(resourceTypes) - .setServices(services) - .setExpiryTime(OffsetDateTime.now().plus(Duration.ofDays(2))) - .generateSasQueryParameters(credential); - // END: com.azure.storage.common.sas.accountSasSignatureValues.generateSasQueryParameters#StorageSharedKeyCredential - } -}