From 3442b4411cba0a955af64c1b070ea939f0aac1bb Mon Sep 17 00:00:00 2001
From: Chris
Date: Fri, 4 Oct 2019 10:42:55 -0700
Subject: [PATCH 01/18] New Checkstyle for disallowed words. (#5530)
---
.../checks/DisallowedWordsCheck.java | 160 ++++++++++++++++++
.../checks/DisallowedWordsCheckTests.java | 72 ++++++++
.../DisallowedWordsTestData.java | 7 +
3 files changed, 239 insertions(+)
create mode 100644 eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheck.java
create mode 100644 eng/code-quality-reports/src/test/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheckTests.java
create mode 100644 eng/code-quality-reports/src/test/resources/com/azure/tools/checkstyle/checks/DisallowedWordsChecks/DisallowedWordsTestData.java
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheck.java
new file mode 100644
index 000000000000..54ec0e07140e
--- /dev/null
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheck.java
@@ -0,0 +1,160 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.tools.checkstyle.checks;
+
+import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public class DisallowedWordsCheck extends AbstractCheck {
+ private static final String MISSING_DISALLOWED_WORDS_PROPERTY = "The disallowedWords property is required for the " + DisallowedWordsCheck.class.getSimpleName() + " module. Please specify which words should be disallowed from being used.";
+ private Set disallowedWords = new HashSet<>();
+ private String errorMessage = "";
+ private boolean applyToPublic = true;
+ private boolean loggedAlready = false;
+
+ /**
+ * Adds words that Classes, Methods and Variables that should follow Camelcasing standards
+ * @param disallowedWords words that should follow normal Camelcasing standards
+ */
+ public final void setDisallowedWords(String... disallowedWords) {
+ if (this.disallowedWords != null) {
+ Collections.addAll(this.disallowedWords, disallowedWords);
+ errorMessage = String.format("All Public API Classes, Fields and Methods should follow "
+ + "Camelcase standards for the following words: %s.", this.disallowedWords.stream().collect(Collectors.joining(", ", "", "")));
+ }
+ }
+
+ @Override
+ public int[] getDefaultTokens() {
+ return getRequiredTokens();
+ }
+
+ @Override
+ public int[] getAcceptableTokens() {
+ return getRequiredTokens();
+ }
+
+ @Override
+ public int[] getRequiredTokens() {
+ return new int[] {TokenTypes.CLASS_DEF,
+ TokenTypes.VARIABLE_DEF,
+ TokenTypes.METHOD_DEF};
+ }
+
+ @Override
+ public void visitToken(DetailAST token) {
+ switch (token.getType()) {
+ case TokenTypes.CLASS_DEF:
+ case TokenTypes.METHOD_DEF:
+ case TokenTypes.VARIABLE_DEF:
+ if (disallowedWords.size() == 0 && !loggedAlready) {
+ log(1, 0, String.format(MISSING_DISALLOWED_WORDS_PROPERTY));
+ loggedAlready = true;
+ break;
+ }
+ String tokenName = token.findFirstToken(TokenTypes.IDENT).getText();
+ if (shouldCheckInScope(token)) {
+ String result = getDisallowedWords(tokenName);
+ if (result != null) {
+ log(token, String.format(errorMessage));
+ }
+ }
+ break;
+ default:
+ // Checkstyle complains if there's no default block in switch
+ break;
+ }
+ }
+
+ /**
+ * Should we check member with given modifiers.
+ *
+ * @param ast
+ * modifiers of member to check.
+ * @return true if we should check such member.
+ */
+ private boolean shouldCheckInScope(DetailAST ast) {
+ final DetailAST modifiersAST =
+ ast.findFirstToken(TokenTypes.MODIFIERS);
+ final boolean isPublic = modifiersAST
+ .findFirstToken(TokenTypes.LITERAL_PUBLIC) != null;
+ return applyToPublic && isPublic;
+ }
+
+ /**
+ * Gets the disallowed abbreviation contained in given String.
+ * @param str
+ * the given String.
+ * @return the disallowed abbreviation contained in given String as a
+ * separate String.
+ */
+ private String getDisallowedWords(String str) {
+ int beginIndex = 0;
+ boolean abbrStarted = false;
+ String result = null;
+
+ for (int index = 0; index < str.length(); index++) {
+ final char symbol = str.charAt(index);
+
+ if (Character.isUpperCase(symbol)) {
+ if (!abbrStarted) {
+ abbrStarted = true;
+ beginIndex = index;
+ }
+ }
+ else if (abbrStarted) {
+ abbrStarted = false;
+
+ final int endIndex = index - 1;
+ result = getAbbreviationIfIllegal(str, beginIndex, endIndex);
+ if (result != null) {
+ break;
+ }
+ beginIndex = -1;
+ }
+ }
+ // if abbreviation at the end of name (example: scaleX)
+ if (abbrStarted) {
+ final int endIndex = str.length() - 1;
+ result = getAbbreviationIfIllegal(str, beginIndex, endIndex);
+ }
+ return result;
+ }
+
+ /**
+ * Get Abbreviation if it is illegal, where {@code beginIndex} and {@code endIndex} are
+ * inclusive indexes of a sequence of consecutive upper-case characters.
+ * @param str name
+ * @param beginIndex begin index
+ * @param endIndex end index
+ * @return the abbreviation if it is bigger than required and not in the
+ * ignore list, otherwise {@code null}
+ */
+ private String getAbbreviationIfIllegal(String str, int beginIndex, int endIndex) {
+ String result = null;
+ final String abbr = getAbbreviation(str, beginIndex, endIndex);
+ if (disallowedWords.contains(abbr)) {
+ result = abbr;
+ }
+ return result;
+ }
+
+ private static String getAbbreviation(String str, int beginIndex, int endIndex) {
+ String result;
+ if (endIndex == str.length() - 1) {
+ result = str.substring(beginIndex);
+ } else {
+ result = str.substring(beginIndex, endIndex);
+ }
+
+ return result;
+ }
+}
diff --git a/eng/code-quality-reports/src/test/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheckTests.java b/eng/code-quality-reports/src/test/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheckTests.java
new file mode 100644
index 000000000000..8c79d1b70bc2
--- /dev/null
+++ b/eng/code-quality-reports/src/test/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheckTests.java
@@ -0,0 +1,72 @@
+package com.azure.tools.checkstyle.checks;
+
+import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
+import com.puppycrawl.tools.checkstyle.Checker;
+import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
+import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
+import org.junit.After;
+import org.junit.Test;
+
+public class DisallowedWordsCheckTests extends AbstractModuleTestSupport {
+ private static final String DISALLOWED_WORD_ERROR_MESSAGE = "All Public API Classes, Fields and Methods should follow" +
+ " Camelcase standards for the following words: XML, HTTP, URL.";
+ private static final String NO_DISALLOWED_WORDS_ERROR_MESSAGE = "The disallowedWords property is required for the DisallowedWordsCheck module. Please specify which words should be disallowed from being used.";
+
+ private Checker checker;
+
+ @After
+ public void cleanup() {
+ checker.destroy();
+ }
+
+ @Override
+ protected String getPackageLocation() {
+ return "com/azure/tools/checkstyle/checks/DisallowedWordsChecks";
+ }
+
+ @Test
+ public void disallowedWordsTestData() throws Exception {
+ checker = prepareCheckStyleChecker(true);
+ checker.addListener(this.getBriefUtLogger());
+ String[] expected = {
+ expectedErrorMessage(2, 5, DISALLOWED_WORD_ERROR_MESSAGE),
+ expectedErrorMessage(4, 5, DISALLOWED_WORD_ERROR_MESSAGE)
+ };
+
+ verify(checker, getPath("DisallowedWordsTestData.java"), expected);
+ }
+
+ @Test
+ public void camelCaseNoPropertySetTestData() throws Exception {
+ checker = prepareCheckStyleChecker(false);
+ checker.addListener(this.getBriefUtLogger());
+ String[] expected = {
+ expectedErrorMessage(1, 1, NO_DISALLOWED_WORDS_ERROR_MESSAGE),
+ };
+
+ verify(checker, getPath("DisallowedWordsTestData.java"), expected);
+ }
+
+ private String expectedErrorMessage(int line, int column, String errorMessage) {
+ return String.format("%d:%d: %s", line, column, errorMessage);
+ }
+
+ private Checker prepareCheckStyleChecker(boolean addDisallowedWords) throws CheckstyleException {
+ Checker checker = new Checker();
+ checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader());
+ checker.configure(prepareConfiguration(addDisallowedWords));
+ return checker;
+ }
+
+ private DefaultConfiguration prepareConfiguration(boolean addDisallowedWords) {
+ DefaultConfiguration checks = new DefaultConfiguration("Checks");
+ DefaultConfiguration treeWalker = new DefaultConfiguration("TreeWalker");
+ DefaultConfiguration camelCaseCheck = new DefaultConfiguration(DisallowedWordsCheck.class.getCanonicalName());
+ if (addDisallowedWords) {
+ camelCaseCheck.addAttribute("disallowedWords", "URL, HTTP, XML");
+ }
+ checks.addChild(treeWalker);
+ treeWalker.addChild(camelCaseCheck);
+ return checks;
+ }
+}
diff --git a/eng/code-quality-reports/src/test/resources/com/azure/tools/checkstyle/checks/DisallowedWordsChecks/DisallowedWordsTestData.java b/eng/code-quality-reports/src/test/resources/com/azure/tools/checkstyle/checks/DisallowedWordsChecks/DisallowedWordsTestData.java
new file mode 100644
index 000000000000..9c65f0bf6ad7
--- /dev/null
+++ b/eng/code-quality-reports/src/test/resources/com/azure/tools/checkstyle/checks/DisallowedWordsChecks/DisallowedWordsTestData.java
@@ -0,0 +1,7 @@
+public class CamelCaseTestData {
+ public boolean errorURLCase;
+
+ public void errorHTTPMethod() { throw new RuntimeException("Error Messages."); }
+
+ public void validHttpMethod() { throw new RuntimeException("Error Messages."); }
+}
From 7e6a5ee2494616f4b87db21e361af0852c3c973b Mon Sep 17 00:00:00 2001
From: Chris
Date: Fri, 4 Oct 2019 10:47:41 -0700
Subject: [PATCH 02/18] New Checkstyle for disallowed words. (#5530)
---
.../src/main/resources/checkstyle/checkstyle.xml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml
index 048abcf4b52e..f1f600738750 100755
--- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml
+++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml
@@ -378,6 +378,16 @@ page at http://checkstyle.sourceforge.net/config.html -->
4) All classes should use ClientLogger as logger only but except ClientLogger itself -->
+
+
+
+
+
+
+
+
+
+
4) All classes should use ClientLogger as logger only but except ClientLogger itself -->
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java
index 054be951fe33..b68bfd99e292 100644
--- a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java
+++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java
@@ -183,7 +183,7 @@ public Certificate getCertificateWithPolicy(String name) {
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Certificate getCertificate(CertificateBase certificateBase) {
- return client.getCertificateWithResponse(certificateBase.name(), certificateBase.version(), Context.NONE).block().getValue();
+ return getCertificateWithResponse(certificateBase.name(), certificateBase.version(), Context.NONE).getValue();
}
/**
@@ -222,7 +222,7 @@ public Response getCertificateWithResponse(String name, String vers
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Certificate getCertificate(String name, String version) {
- return client.getCertificateWithResponse(name, version, Context.NONE).block().getValue();
+ return getCertificateWithResponse(name, version, Context.NONE).getValue();
}
/**
@@ -243,7 +243,7 @@ public Certificate getCertificate(String name, String version) {
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Certificate updateCertificate(CertificateBase certificate) {
- return client.updateCertificateWithResponse(certificate, Context.NONE).block().getValue();
+ return updateCertificateWithResponse(certificate, Context.NONE).getValue();
}
/**
@@ -742,7 +742,7 @@ public Response updateCertificatePolicyWithResponse(String ce
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Issuer createCertificateIssuer(String name, String provider) {
- return client.createCertificateIssuerWithResponse(name, provider, Context.NONE).block().getValue();
+ return createCertificateIssuerWithResponse(new Issuer(name, provider), Context.NONE).getValue();
}
/**
@@ -1148,7 +1148,7 @@ public Response deleteCertificateOperationWithResponse(Str
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public CertificateOperation cancelCertificateOperation(String certificateName) {
- return client.cancelCertificateOperationWithResponse(certificateName, Context.NONE).block().getValue();
+ return cancelCertificateOperationWithResponse(certificateName, Context.NONE).getValue();
}
@@ -1224,7 +1224,7 @@ public Response getPendingCertificateSigningRequestWithResponse(String c
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Certificate mergeCertificate(String name, List x509Certificates) {
- return client.mergeCertificateWithResponse(name, x509Certificates, Context.NONE).block().getValue();
+ return mergeCertificateWithResponse(name, x509Certificates, Context.NONE).getValue();
}
/**
diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java
index b697afe58811..58fb891b95ee 100644
--- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java
+++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java
@@ -69,7 +69,7 @@ public final class KeyClient {
* @throws HttpRequestException if {@code name} is empty string.
*/
public Key createKey(String name, KeyType keyType) {
- return client.createKeyWithResponse(name, keyType, Context.NONE).block().getValue();
+ return createKeyWithResponse(new KeyCreateOptions(name, keyType), Context.NONE).getValue();
}
/**
@@ -262,7 +262,7 @@ public Response createEcKeyWithResponse(EcKeyCreateOptions ecKeyCreateOptio
* @throws HttpRequestException if {@code name} is empty string.
*/
public Key importKey(String name, JsonWebKey keyMaterial) {
- return client.importKeyWithResponse(name, keyMaterial, Context.NONE).block().getValue();
+ return importKeyWithResponse(new KeyImportOptions(name, keyMaterial), Context.NONE).getValue();
}
/**
@@ -450,7 +450,7 @@ public Response getKeyWithResponse(KeyBase keyBase, Context context) {
* string.
*/
public Key updateKey(KeyBase key) {
- return client.updateKeyWithResponse(key, Context.NONE).block().getValue();
+ return updateKeyWithResponse(key, Context.NONE).getValue();
}
/**
diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClient.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClient.java
index f536514462ff..973d3beb39a0 100644
--- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClient.java
+++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClient.java
@@ -82,7 +82,7 @@ public Secret setSecret(Secret secret) {
* @throws HttpRequestException if {@code name} or {@code value} is empty string.
*/
public Secret setSecret(String name, String value) {
- return client.setSecretWithResponse(name, value, Context.NONE).block().getValue();
+ return setSecretWithResponse(new Secret(name, value), Context.NONE).getValue();
}
/**
From a72edc859f377d68b824eb7ead0acd2e3f051234 Mon Sep 17 00:00:00 2001
From: Sima Zhu <48036328+sima-zhu@users.noreply.github.com>
Date: Fri, 4 Oct 2019 11:06:56 -0700
Subject: [PATCH 09/18] Move the datalake error models to implementation model
(#5695)
---
.../java/com/azure/storage/blob/implementation/BlobsImpl.java | 2 +-
.../com/azure/storage/blob/implementation/DirectorysImpl.java | 2 +-
.../blob/{ => implementation}/models/DataLakeStorageError.java | 2 +-
.../{ => implementation}/models/DataLakeStorageErrorError.java | 2 +-
.../models/DataLakeStorageErrorException.java | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
rename sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/{ => implementation}/models/DataLakeStorageError.java (95%)
rename sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/{ => implementation}/models/DataLakeStorageErrorError.java (96%)
rename sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/{ => implementation}/models/DataLakeStorageErrorException.java (96%)
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java
index 570679513706..5626195f0321 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java
@@ -47,7 +47,7 @@
import com.azure.storage.blob.models.AccessTier;
import com.azure.storage.blob.models.BlobHTTPHeaders;
import com.azure.storage.blob.models.CpkInfo;
-import com.azure.storage.blob.models.DataLakeStorageErrorException;
+import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException;
import com.azure.storage.blob.models.DeleteSnapshotsOptionType;
import com.azure.storage.blob.models.EncryptionAlgorithmType;
import com.azure.storage.blob.models.LeaseAccessConditions;
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java
index ad2632e9f511..e26340bd8079 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java
@@ -27,7 +27,7 @@
import com.azure.storage.blob.implementation.models.DirectorysGetAccessControlResponse;
import com.azure.storage.blob.implementation.models.DirectorysRenameResponse;
import com.azure.storage.blob.implementation.models.DirectorysSetAccessControlResponse;
-import com.azure.storage.blob.models.DataLakeStorageErrorException;
+import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException;
import com.azure.storage.blob.models.LeaseAccessConditions;
import com.azure.storage.blob.models.ModifiedAccessConditions;
import com.azure.storage.blob.models.PathRenameMode;
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageError.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/DataLakeStorageError.java
similarity index 95%
rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageError.java
rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/DataLakeStorageError.java
index 22a564f4bc04..dd2d6ba4ef39 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageError.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/DataLakeStorageError.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.storage.blob.models;
+package com.azure.storage.blob.implementation.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorError.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/DataLakeStorageErrorError.java
similarity index 96%
rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorError.java
rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/DataLakeStorageErrorError.java
index cbc4b7d8b8d4..e56b950c2221 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorError.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/DataLakeStorageErrorError.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.storage.blob.models;
+package com.azure.storage.blob.implementation.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorException.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/DataLakeStorageErrorException.java
similarity index 96%
rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorException.java
rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/DataLakeStorageErrorException.java
index 4516ccd4031b..97c610cbc134 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorException.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/DataLakeStorageErrorException.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
-package com.azure.storage.blob.models;
+package com.azure.storage.blob.implementation.models;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.http.HttpResponse;
From ae62758365f30cb3ebe4db651fa4570c3547efe5 Mon Sep 17 00:00:00 2001
From: Sima Zhu <48036328+sima-zhu@users.noreply.github.com>
Date: Fri, 4 Oct 2019 11:31:44 -0700
Subject: [PATCH 10/18] Readme update for sasToken API in builder (#5697)
---
sdk/storage/azure-storage-blob/CHANGELOG.md | 2 ++
sdk/storage/azure-storage-file/CHANGELOG.md | 2 ++
sdk/storage/azure-storage-queue/CHANGELOG.md | 3 +++
sdk/storage/azure-storage-queue/README.md | 8 ++++----
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/sdk/storage/azure-storage-blob/CHANGELOG.md b/sdk/storage/azure-storage-blob/CHANGELOG.md
index cc1186980e94..33765f6cd457 100644
--- a/sdk/storage/azure-storage-blob/CHANGELOG.md
+++ b/sdk/storage/azure-storage-blob/CHANGELOG.md
@@ -25,6 +25,8 @@ and
- Renamed `setTier` to `setAccessTier` from `BlobAsyncClientBase` and `BlobClientBase` classes.
- Added `ParallelTransferOptions` to buffered upload, upload from file and download to file methods.
- Removed `Metadata` class and uses Map for `matadata` field of `BlobProperties` and `ContainerProperties`.
+- Removed SAS token generation APIs from clients, use BlobServiceSasSignatureValues to generate SAS tokens.
+- Removed `SASTokenCredential`, `SASTokenCredentialPolicy` and the corresponding `credential(SASTokenCredential)` method in client builder, and added sasToken(String) instead.
## Version 12.0.0-preview.3 (2019-09-10)
For details on the Azure SDK for Java (September 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview3-java).
diff --git a/sdk/storage/azure-storage-file/CHANGELOG.md b/sdk/storage/azure-storage-file/CHANGELOG.md
index 2a59156fb536..52416b2a7e2b 100644
--- a/sdk/storage/azure-storage-file/CHANGELOG.md
+++ b/sdk/storage/azure-storage-file/CHANGELOG.md
@@ -15,6 +15,8 @@ and
- Fixed metadata does not allow capital letter issue. [`Bug 5295`](https://github.com/Azure/azure-sdk-for-java/issues/5295)
- Updated the return type of `downloadToFile` API to `FileProperties` on sync API and `Mono` on async API.
- `getFileServiceUrl`, `getShareUrl`, `getDirectoryUrl`, `getFileUrl` API now returns URL with scheme, host, resource name and snapshot if any.
+- Removed SAS token generation APIs from clients, use FileServiceSasSignatureValues to generate SAS tokens.
+- Removed `SASTokenCredential`, `SASTokenCredentialPolicy` and the corresponding `credential(SASTokenCredential)` method in client builder, and added sasToken(String) instead.
## Version 12.0.0-preview.3 (2019-09-10):
For details on the Azure SDK for Java (September 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview3-java).
diff --git a/sdk/storage/azure-storage-queue/CHANGELOG.md b/sdk/storage/azure-storage-queue/CHANGELOG.md
index c947852031c2..f45a07a77b83 100644
--- a/sdk/storage/azure-storage-queue/CHANGELOG.md
+++ b/sdk/storage/azure-storage-queue/CHANGELOG.md
@@ -13,6 +13,9 @@ and
- Changed `VoidResponse` to `Response` on sync API, and `Mono` to `Mono>` on async API.
- Fixed metadata does not allow capital letter issue. [`Bug 5295`](https://github.com/Azure/azure-sdk-for-java/issues/5295)
- `getQueueServiceUrl`, `getQueueUrl` API now returns URL with scheme, host, resource name and snapshot if any.
+- Removed SAS token generation APIs from clients, use QueueServiceSasSignatureValues to generate SAS tokens.
+- Removed `SASTokenCredential`, `SASTokenCredentialPolicy` and the corresponding `credential(SASTokenCredential)` method in client builder, and added sasToken(String) instead.
+
## Version 12.0.0-preview.3 (2019-09-10)
diff --git a/sdk/storage/azure-storage-queue/README.md b/sdk/storage/azure-storage-queue/README.md
index 1002bf948f95..2b469b37d608 100644
--- a/sdk/storage/azure-storage-queue/README.md
+++ b/sdk/storage/azure-storage-queue/README.md
@@ -158,7 +158,7 @@ The client performs the interactions with the Queue service, create or delete a
Once you have the value of the SASToken you can create the queue service client with `${accountName}`, `${SASToken}`.
```Java
String queueServiceURL = String.format("https://%s.queue.core.windows.net", accountName);
-QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueServiceURL).credential(SASToken).buildClient();
+QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueURL).sasToken(SASToken).build();
QueueClient newQueueClient = queueServiceClient.createQueue("myqueue");
```
@@ -168,7 +168,7 @@ or
```Java
String queueServiceAsyncURL = String.format("https://%s.queue.core.windows.net/", accountName);
QueueServiceAsyncClient queueServiceAsyncClient = new QueueServiceClientBuilder().endpoint(queueServiceAsyncURL)
-.credential(SASToken).buildAsyncClient();
+.sasToken(SASToken).buildAsyncClient();
queueServiceAsyncClient.createQueue("newAsyncQueue").subscribe(
result -> {
// do something when new queue created
@@ -189,7 +189,7 @@ A single queue message can be up to 64 KB in size, and a queue can contain milli
Once you have the value of the SASToken you can create the queue service client with `${accountName}`, `${queueName}`, `${SASToken}`.
```Java
String queueURL = String.format("https://%s.queue.core.windows.net/%s", accountName, queueName);
-QueueClient queueClient = new QueueClientBuilder().endpoint(queueURL).credential(SASToken).buildClient();
+QueueClient queueClient = new QueueClientBuilder().endpoint(queueURL).sasToken(SASToken).buildClient();
// metadata is map of key-value pair
queueClient.createWithResponse(metadata, null, Duration.ofSeconds(30), Context.NONE);
@@ -392,7 +392,7 @@ The operation sets user-defined metadata on the specified queue. Metadata is ass
Use `${SASToken}` as credential.
```Java
String queueSURL = String.format("https://%s.queue.core.windows.net", accountName);
-QueueClient queueClient = new QueueClientBuilder().endpoint(queueURL).credential(SASToken).queueName("myqueue").buildClient();
+QueueClient queueClient = new QueueClientBuilder().endpoint(queueURL).sasToken(SASToken).queueName("myqueue").buildClient();
Map metadata = new HashMap() {{
put("key1", "val1");
From e0a4a3e4cabccfd8c0d129de86d44b927aa5f0bb Mon Sep 17 00:00:00 2001
From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com>
Date: Fri, 4 Oct 2019 12:07:05 -0700
Subject: [PATCH 11/18] Remove SAS Generation Methods from Clients (#5617)
* Remove SAS generation methods from Azure Blob clients
* Add some resource type logic to BlobServiceSASSignatureValues
* Fix failing test
* Removed SAS token methods in Queue clients
* Fixing some more tests
* Fix Javadoc links
* Fixing linting issues, prototyping BlobSasConstructor
* Minor refactoring in new class
* Re-record failing tests
* Fix checkstyle issues
* Fix accidentally method name change
* Fix javadoc issue
* Cleanup checkstyle issues
* Make SAS generation classes public API
* Fixing checkstyle issues
---
.../blob/BlobContainerAsyncClient.java | 200 +----------------
.../storage/blob/BlobContainerClient.java | 171 ++-------------
.../storage/blob/BlobServiceAsyncClient.java | 56 -----
.../azure/storage/blob/BlobServiceClient.java | 47 ----
.../blob/specialized/BlobAsyncClientBase.java | 203 ------------------
.../blob/specialized/BlobClientBase.java | 144 -------------
.../BlobServiceSasSignatureValues.java | 38 +++-
.../BlobAsyncClientJavaDocCodeSnippets.java | 69 ------
.../blob/BlobClientJavaDocCodeSnippets.java | 68 ------
...ntainerAsyncClientJavaDocCodeSnippets.java | 72 -------
...lobContainerClientJavaDocCodeSnippets.java | 72 -------
...ServiceAsyncClientJavaDocCodeSnippets.java | 48 +----
.../BlobServiceClientJavaDocCodeSnippets.java | 44 +---
...lobAsyncClientBaseJavaDocCodeSnippets.java | 70 ------
.../BlobClientBaseJavaDocCodeSnippets.java | 69 ------
.../com/azure/storage/blob/BlobAPITest.groovy | 10 +-
.../com/azure/storage/blob/CPKTest.groovy | 31 ++-
.../com/azure/storage/blob/SASTest.groovy | 137 +++++++++---
.../blob/specialized/HelperTest.groovy | 16 +-
...accountsasnetworkcreatecontainerfails.json | 58 ++---
...ountsasnetworkcreatecontainersucceeds.json | 72 +++----
...taccountsasnetworktestblobdeletefails.json | 74 +++----
.../SASTestaccountsasnetworktestblobread.json | 79 ++++---
...blobservicesasnetworktestblobsnapshot.json | 158 +++++++-------
...vicesassignaturevaluesnetworktestblob.json | 112 +++++-----
...ignaturevaluesnetworktestblobsnapshot.json | 118 +++++-----
...assignaturevaluesnetworktestcontainer.json | 88 ++++----
.../azure/storage/file/FileAsyncClient.java | 113 ----------
.../com/azure/storage/file/FileClient.java | 73 -------
.../storage/file/FileServiceAsyncClient.java | 56 -----
.../azure/storage/file/FileServiceClient.java | 48 -----
.../file/FileServiceSasSignatureValues.java | 2 +-
.../azure/storage/file/ShareAsyncClient.java | 113 ----------
.../com/azure/storage/file/ShareClient.java | 72 -------
.../file/FileAsyncJavaDocCodeSamples.java | 33 ---
.../storage/file/FileJavaDocCodeSamples.java | 33 ---
.../FileServiceAsyncJavaDocCodeSamples.java | 44 ----
.../file/FileServiceJavaDocCodeSamples.java | 46 ----
.../file/ShareAsyncJavaDocCodeSamples.java | 34 ---
.../storage/file/ShareJavaDocCodeSamples.java | 34 ---
.../com/azure/storage/file/APISpec.groovy | 5 +-
.../azure/storage/file/FileAPITests.groovy | 9 +-
.../storage/file/FileAsyncAPITests.groovy | 10 +-
.../azure/storage/file/FileSASTests.groovy | 64 +++++-
.../azure/storage/queue/QueueAsyncClient.java | 70 ------
.../com/azure/storage/queue/QueueClient.java | 49 -----
.../queue/QueueServiceAsyncClient.java | 58 +----
.../storage/queue/QueueServiceClient.java | 49 -----
.../queue/QueueServiceSasSignatureValues.java | 2 +-
.../queue/QueueAsyncJavaDocCodeSamples.java | 28 ---
.../queue/QueueJavaDocCodeSamples.java | 28 ---
.../QueueServiceAsyncJavaDocCodeSamples.java | 44 ----
.../queue/QueueServiceJavaDocCodeSamples.java | 44 ----
.../com/azure/storage/queue/APISpec.groovy | 21 +-
.../azure/storage/queue/QueueSASTests.groovy | 40 +++-
55 files changed, 697 insertions(+), 2849 deletions(-)
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 5ed79aae5c3a..57e4f698d7cb 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
@@ -29,18 +29,10 @@
import com.azure.storage.blob.models.SignedIdentifier;
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.blob.models.StorageException;
-import com.azure.storage.blob.models.UserDelegationKey;
-import com.azure.storage.blob.specialized.BlobServiceSasQueryParameters;
-import com.azure.storage.blob.specialized.BlobServiceSasSignatureValues;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
-import com.azure.storage.common.credentials.SharedKeyCredential;
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;
@@ -290,7 +282,7 @@ public Mono> deleteWithResponse(BlobContainerAccessConditions acc
Mono> deleteWithResponse(BlobContainerAccessConditions accessConditions, Context context) {
accessConditions = accessConditions == null ? new BlobContainerAccessConditions() : accessConditions;
- if (!validateNoEtag(accessConditions.getModifiedAccessConditions())) {
+ if (!validateNoETag(accessConditions.getModifiedAccessConditions())) {
// Throwing is preferred to Single.error because this will error out immediately instead of waiting until
// subscription.
throw logger.logExceptionAsError(
@@ -379,7 +371,7 @@ public Mono> setMetadataWithResponse(Map metadata
Mono> setMetadataWithResponse(Map metadata,
BlobContainerAccessConditions accessConditions, Context context) {
accessConditions = accessConditions == null ? new BlobContainerAccessConditions() : accessConditions;
- if (!validateNoEtag(accessConditions.getModifiedAccessConditions())
+ if (!validateNoETag(accessConditions.getModifiedAccessConditions())
|| accessConditions.getModifiedAccessConditions().getIfUnmodifiedSince() != null) {
// Throwing is preferred to Single.error because this will error out immediately instead of waiting until
// subscription.
@@ -486,7 +478,7 @@ Mono> setAccessPolicyWithResponse(PublicAccessType accessType, Li
BlobContainerAccessConditions accessConditions, Context context) {
accessConditions = accessConditions == null ? new BlobContainerAccessConditions() : accessConditions;
- if (!validateNoEtag(accessConditions.getModifiedAccessConditions())) {
+ if (!validateNoETag(accessConditions.getModifiedAccessConditions())) {
// Throwing is preferred to Single.error because this will error out immediately instead of waiting until
// subscription.
throw logger.logExceptionAsError(
@@ -785,194 +777,10 @@ Mono> getAccountInfoWithResponse(Context context) {
}
- private boolean validateNoEtag(ModifiedAccessConditions modifiedAccessConditions) {
+ private boolean validateNoETag(ModifiedAccessConditions modifiedAccessConditions) {
if (modifiedAccessConditions == null) {
return true;
}
return modifiedAccessConditions.getIfMatch() == null && modifiedAccessConditions.getIfNoneMatch() == null;
}
-
- /**
- * Generates a user delegation SAS with the specified parameters
- *
- * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS
- * @param accountName The {@code String} account name for the SAS
- * @param permissions The {@code BlobContainerSasPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @return A string that represents the SAS token
- */
- public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName,
- BlobContainerSasPermission permissions, OffsetDateTime expiryTime) {
- return this.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime, null, null,
- null, null, null, null, null, null, null);
- }
-
- /**
- * Generates a user delegation SAS token with the specified parameters
- *
- * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS
- * @param accountName The {@code String} account name for the SAS
- * @param permissions The {@code BlobContainerSasPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- */
- public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName,
- BlobContainerSasPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version,
- SASProtocol sasProtocol, IpRange ipRange) {
- return this.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime, startTime,
- version, sasProtocol, ipRange, null /* cacheControl */, null /* contentDisposition */, null /*
- contentEncoding */, null /* contentLanguage */, null /* contentType */);
- }
-
- /**
- * Generates a user delegation SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.blob.BlobContainerAsyncClient.generateUserDelegationSAS#UserDelegationKey-String-BlobContainerSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String}
- *
- * For more information, see the
- * Azure
- * Docs
- *
- * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS
- * @param accountName The {@code String} account name for the SAS
- * @param permissions The {@code BlobContainerSasPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param cacheControl An optional {@code String} cache-control header for the SAS.
- * @param contentDisposition An optional {@code String} content-disposition header for the SAS.
- * @param contentEncoding An optional {@code String} content-encoding header for the SAS.
- * @param contentLanguage An optional {@code String} content-language header for the SAS.
- * @param contentType An optional {@code String} content-type header for the SAS.
- * @return A string that represents the SAS token
- */
- public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName,
- BlobContainerSasPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version,
- SASProtocol sasProtocol, IpRange ipRange, String cacheControl, String contentDisposition,
- String contentEncoding, String contentLanguage, String contentType) {
- BlobServiceSasSignatureValues blobServiceSASSignatureValues = new BlobServiceSasSignatureValues(version,
- sasProtocol, startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange,
- null /* identifier*/, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
-
- BlobServiceSasSignatureValues values =
- configureServiceSASSignatureValues(blobServiceSASSignatureValues, accountName);
-
- BlobServiceSasQueryParameters blobServiceSasQueryParameters =
- values.generateSASQueryParameters(userDelegationKey);
-
- return blobServiceSasQueryParameters.encode();
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param permissions The {@code BlobContainerSasPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @return A string that represents the SAS token
- */
- public String generateSAS(BlobContainerSasPermission permissions, OffsetDateTime expiryTime) {
- return this.generateSAS(null, permissions, /* identifier */ expiryTime, null /* startTime */, null /* version
- */, null /* sasProtocol */, null /* ipRange */, null /* cacheControl */, null /* contentDisposition */,
- null /* contentEncoding */, null /* contentLanguage */, null /*contentType*/);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the container this SAS references if any
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier) {
- return this.generateSAS(identifier, null /* permissions*/, null /* expiryTime */, null /* startTime */, null
- /* version */, null /* sasProtocol */, null /* ipRange */, null /* cacheControl */, null /*
- contentDisposition */, null /* contentEncoding */, null /* contentLanguage */, null /*contentType*/);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the container this SAS references if any
- * @param permissions The {@code BlobContainerSasPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier, BlobContainerSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange) {
- return this.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange, null
- /* cacheControl */, null /* contentDisposition */, null /* contentEncoding */, null /* contentLanguage */,
- null /*contentType*/);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.blob.BlobContainerAsyncClient.generateSAS#String-BlobContainerSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String}
- *
- * For more information, see the
- * Azure Docs
- *
- * @param identifier The {@code String} name of the access policy on the container this SAS references if any
- * @param permissions The {@code BlobContainerSasPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param cacheControl An optional {@code String} cache-control header for the SAS.
- * @param contentDisposition An optional {@code String} content-disposition header for the SAS.
- * @param contentEncoding An optional {@code String} content-encoding header for the SAS.
- * @param contentLanguage An optional {@code String} content-language header for the SAS.
- * @param contentType An optional {@code String} content-type header for the SAS.
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier, BlobContainerSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange, String cacheControl,
- String contentDisposition, String contentEncoding, String contentLanguage, String contentType) {
- BlobServiceSasSignatureValues blobServiceSASSignatureValues = new BlobServiceSasSignatureValues(version,
- sasProtocol, startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange,
- identifier, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
-
- SharedKeyCredential sharedKeyCredential =
- Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline());
-
- Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential);
-
- BlobServiceSasSignatureValues values = configureServiceSASSignatureValues(blobServiceSASSignatureValues,
- sharedKeyCredential.getAccountName());
-
- BlobServiceSasQueryParameters blobServiceSasQueryParameters =
- values.generateSASQueryParameters(sharedKeyCredential);
-
- return blobServiceSasQueryParameters.encode();
- }
-
- /**
- * Sets blobServiceSASSignatureValues parameters dependent on the current blob type
- */
- private BlobServiceSasSignatureValues configureServiceSASSignatureValues(
- BlobServiceSasSignatureValues blobServiceSASSignatureValues, String accountName) {
- // Set canonical name
- blobServiceSASSignatureValues.setCanonicalName(this.azureBlobStorage.getUrl(), accountName);
-
- // Set snapshotId to null
- blobServiceSASSignatureValues.setSnapshotId(null);
-
- // Set resource
- blobServiceSASSignatureValues.setResource(Constants.UrlConstants.SAS_CONTAINER_CONSTANT);
- return blobServiceSASSignatureValues;
- }
}
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 e8b37a78173b..66dfdd95c45a 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,14 +17,10 @@
import com.azure.storage.blob.models.PublicAccessType;
import com.azure.storage.blob.models.SignedIdentifier;
import com.azure.storage.blob.models.StorageAccountInfo;
-import com.azure.storage.blob.models.UserDelegationKey;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
import reactor.core.publisher.Mono;
import java.time.Duration;
-import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;
@@ -61,6 +57,7 @@ public final class BlobContainerClient {
this.blobContainerAsyncClient = blobContainerAsyncClient;
}
+
/**
* Initializes a new BlobClient object by concatenating blobName to the end of ContainerAsyncClient's URL. The new
* BlobClient uses the same request policy pipeline as the ContainerAsyncClient. To change the pipeline, create the
@@ -96,6 +93,19 @@ public BlobClient getBlobClient(String blobName, String snapshot) {
return new BlobClient(blobContainerAsyncClient.getBlobAsyncClient(blobName, snapshot));
}
+ /**
+ * Get the container name.
+ *
+ * Code Samples
+ *
+ * {@codesnippet com.azure.storage.blob.BlobContainerClient.getBlobContainerName}
+ *
+ * @return The name of container.
+ */
+ public String getBlobContainerName() {
+ return this.blobContainerAsyncClient.getBlobContainerName();
+ }
+
/**
* Gets the URL of the container represented by this client.
*
@@ -532,157 +542,4 @@ public Response getAccountInfoWithResponse(Duration timeout,
return Utility.blockWithOptionalTimeout(response, timeout);
}
-
- /**
- * Generates a user delegation SAS token with the specified parameters
- *
- * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS
- * @param accountName The {@code String} account name for the SAS
- * @param permissions The {@code BlobContainerSasPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @return A string that represents the SAS token
- */
- public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName,
- BlobContainerSasPermission permissions, OffsetDateTime expiryTime) {
- return this.blobContainerAsyncClient.generateUserDelegationSAS(userDelegationKey, accountName, permissions,
- expiryTime);
- }
-
- /**
- * Generates a user delegation SAS token with the specified parameters
- *
- * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS
- * @param accountName The {@code String} account name for the SAS
- * @param permissions The {@code BlobContainerSasPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- */
- public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName,
- BlobContainerSasPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version,
- SASProtocol sasProtocol, IpRange ipRange) {
- return this.blobContainerAsyncClient.generateUserDelegationSAS(userDelegationKey, accountName, permissions,
- expiryTime, startTime, version, sasProtocol, ipRange);
- }
-
- /**
- * Generates a user delegation SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.blob.BlobContainerClient.generateUserDelegationSAS#UserDelegationKey-String-BlobContainerSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String}
- *
- * For more information, see the
- * Azure
- * Docs
- *
- * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS
- * @param accountName The {@code String} account name for the SAS
- * @param permissions The {@code BlobContainerSasPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param cacheControl An optional {@code String} cache-control header for the SAS.
- * @param contentDisposition An optional {@code String} content-disposition header for the SAS.
- * @param contentEncoding An optional {@code String} content-encoding header for the SAS.
- * @param contentLanguage An optional {@code String} content-language header for the SAS.
- * @param contentType An optional {@code String} content-type header for the SAS.
- * @return A string that represents the SAS token
- */
- public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName,
- BlobContainerSasPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version,
- SASProtocol sasProtocol, IpRange ipRange, String cacheControl, String contentDisposition,
- String contentEncoding, String contentLanguage, String contentType) {
- return this.blobContainerAsyncClient.generateUserDelegationSAS(userDelegationKey, accountName, permissions,
- expiryTime, startTime, version, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding,
- contentLanguage, contentType);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param permissions The {@code BlobContainerSasPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @return A string that represents the SAS token
- */
- public String generateSAS(BlobContainerSasPermission permissions, OffsetDateTime expiryTime) {
- return this.blobContainerAsyncClient.generateSAS(permissions, expiryTime);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the container this SAS references if any
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier) {
- return this.blobContainerAsyncClient.generateSAS(identifier);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the container this SAS references if any
- * @param permissions The {@code BlobContainerSasPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier, BlobContainerSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange) {
- return this.blobContainerAsyncClient.generateSAS(identifier, permissions, expiryTime, startTime, version,
- sasProtocol, ipRange);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.blob.BlobContainerClient.generateSAS#String-BlobContainerSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String}
- *
- * For more information, see the
- * Azure Docs
- *
- * @param identifier The {@code String} name of the access policy on the container this SAS references if any
- * @param permissions The {@code BlobContainerSasPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param cacheControl An optional {@code String} cache-control header for the SAS.
- * @param contentDisposition An optional {@code String} content-disposition header for the SAS.
- * @param contentEncoding An optional {@code String} content-encoding header for the SAS.
- * @param contentLanguage An optional {@code String} content-language header for the SAS.
- * @param contentType An optional {@code String} content-type header for the SAS.
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier, BlobContainerSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange, String cacheControl,
- String contentDisposition, String contentEncoding, String contentLanguage, String contentType) {
- return this.blobContainerAsyncClient.generateSAS(identifier, permissions, expiryTime, startTime, version,
- sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- }
-
- /**
- * Get the container name.
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.blob.BlobContainerClient.getBlobContainerName}
- *
- * @return The name of container.
- */
- public String getBlobContainerName() {
- return this.blobContainerAsyncClient.getBlobContainerName();
- }
}
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 63e8fac4eb20..8dad684c6c19 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
@@ -26,14 +26,7 @@
import com.azure.storage.blob.models.StorageServiceProperties;
import com.azure.storage.blob.models.StorageServiceStats;
import com.azure.storage.blob.models.UserDelegationKey;
-import com.azure.storage.common.AccountSASPermission;
-import com.azure.storage.common.AccountSASResourceType;
-import com.azure.storage.common.AccountSASService;
-import com.azure.storage.common.AccountSASSignatureValues;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
-import com.azure.storage.common.credentials.SharedKeyCredential;
import reactor.core.publisher.Mono;
import java.time.Duration;
@@ -453,53 +446,4 @@ Mono> getAccountInfoWithResponse(Context context) {
return postProcessResponse(this.azureBlobStorage.services().getAccountInfoWithRestResponseAsync(context))
.map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.getDeserializedHeaders())));
}
-
- /**
- * Generates an account SAS token with the specified parameters
- *
- * @param accountSASService The {@code AccountSASService} services for the account SAS
- * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS
- * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException if {@code sharedKeyCredential} is null
- */
- public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType,
- AccountSASPermission accountSASPermission, OffsetDateTime expiryTime) {
- return this.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime,
- null /* startTime */, null /* version */, null /* ipRange */, null /* sasProtocol */);
- }
-
- /**
- * Generates an account SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.blob.blobServiceAsyncClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol}
- *
- * For more information, see the
- * Azure Docs
- *
- * @param accountSASService The {@code AccountSASService} services for the account SAS
- * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS
- * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS
- * @param startTime The {@code OffsetDateTime} start time for the account SAS
- * @param version The {@code String} version for the account SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException if {@code sharedKeyCredential} is null
- */
- public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType,
- AccountSASPermission accountSASPermission, OffsetDateTime expiryTime, OffsetDateTime startTime,
- String version, IpRange ipRange, SASProtocol sasProtocol) {
-
- SharedKeyCredential sharedKeyCredential =
- Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline());
- Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential);
-
- return AccountSASSignatureValues.generateAccountSAS(sharedKeyCredential, accountSASService,
- accountSASResourceType, accountSASPermission, expiryTime, startTime, version, ipRange, sasProtocol);
- }
}
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 7e6d13c51843..0bb9ecc96066 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,11 +17,6 @@
import com.azure.storage.blob.models.StorageServiceProperties;
import com.azure.storage.blob.models.StorageServiceStats;
import com.azure.storage.blob.models.UserDelegationKey;
-import com.azure.storage.common.AccountSASPermission;
-import com.azure.storage.common.AccountSASResourceType;
-import com.azure.storage.common.AccountSASService;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
import reactor.core.publisher.Mono;
@@ -359,46 +354,4 @@ public Response getAccountInfoWithResponse(Duration timeout,
return Utility.blockWithOptionalTimeout(response, timeout);
}
-
- /**
- * Generates an account SAS token with the specified parameters
- *
- * @param accountSASService The {@code AccountSASService} services for the account SAS
- * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS
- * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS
- * @return A string that represents the SAS token
- */
- public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType,
- AccountSASPermission accountSASPermission, OffsetDateTime expiryTime) {
- return this.blobServiceAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType,
- accountSASPermission, expiryTime);
- }
-
- /**
- * Generates an account SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.blob.blobServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol}
- *
- * For more information, see the
- * Azure Docs
- *
- * @param accountSASService The {@code AccountSASService} services for the account SAS
- * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS
- * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS
- * @param startTime The {@code OffsetDateTime} start time for the account SAS
- * @param version The {@code String} version for the account SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @return A string that represents the SAS token
- */
- public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType,
- AccountSASPermission accountSASPermission, OffsetDateTime expiryTime, OffsetDateTime startTime,
- String version, IpRange ipRange, SASProtocol sasProtocol) {
- return this.blobServiceAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType,
- accountSASPermission, expiryTime, startTime, version, ipRange, sasProtocol);
- }
}
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 e2bcd5812b85..d50317535180 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
@@ -11,7 +11,6 @@
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.BlobProperties;
-import com.azure.storage.blob.BlobSasPermission;
import com.azure.storage.blob.BlobURLParts;
import com.azure.storage.blob.HTTPGetterInfo;
import com.azure.storage.blob.implementation.AzureBlobStorageBuilder;
@@ -30,12 +29,8 @@
import com.azure.storage.blob.models.SourceModifiedAccessConditions;
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.blob.models.StorageException;
-import com.azure.storage.blob.models.UserDelegationKey;
import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
-import com.azure.storage.common.credentials.SharedKeyCredential;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;
@@ -49,7 +44,6 @@
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
-import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -974,201 +968,4 @@ Mono> getAccountInfoWithResponse(Context context) {
this.azureBlobStorage.blobs().getAccountInfoWithRestResponseAsync(null, null, context))
.map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.getDeserializedHeaders())));
}
-
- /**
- * Generates a user delegation SAS with the specified parameters
- *
- * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS
- * @param accountName The {@code String} account name for the SAS
- * @param permissions The {@code ContainerSASPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @return A string that represents the SAS token
- */
- public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName,
- BlobSasPermission permissions, OffsetDateTime expiryTime) {
- return this.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime, null /*
- startTime */, null /* version */, null /*sasProtocol */, null /* ipRange */, null /* cacheControl */, null
- /*contentDisposition */, null /* contentEncoding */, null /* contentLanguage */, null /* contentType */);
- }
-
- /**
- * Generates a user delegation SAS token with the specified parameters
- *
- * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS
- * @param accountName The {@code String} account name for the SAS
- * @param permissions The {@code ContainerSASPermissions} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- */
- public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName,
- BlobSasPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version,
- SASProtocol sasProtocol, IpRange ipRange) {
- return this.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime, startTime,
- version, sasProtocol, ipRange, null /* cacheControl */, null /* contentDisposition */, null /*
- contentEncoding */, null /* contentLanguage */, null /* contentType */);
- }
-
- /**
- * Generates a user delegation SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.generateUserDelegationSAS#UserDelegationKey-String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String}
- *
- * For more information, see the
- * Azure
- * Docs
- *
- * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS
- * @param accountName The {@code String} account name for the SAS
- * @param permissions The {@code BlobSASPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param cacheControl An optional {@code String} cache-control header for the SAS.
- * @param contentDisposition An optional {@code String} content-disposition header for the SAS.
- * @param contentEncoding An optional {@code String} content-encoding header for the SAS.
- * @param contentLanguage An optional {@code String} content-language header for the SAS.
- * @param contentType An optional {@code String} content-type header for the SAS.
- * @return A string that represents the SAS token
- */
- public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName,
- BlobSasPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version,
- SASProtocol sasProtocol, IpRange ipRange, String cacheControl, String contentDisposition,
- String contentEncoding, String contentLanguage, String contentType) {
-
- BlobServiceSasSignatureValues blobServiceSASSignatureValues = new BlobServiceSasSignatureValues(version,
- sasProtocol, startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange,
- null /* identifier*/, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
-
- BlobServiceSasSignatureValues values = configureServiceSASSignatureValues(blobServiceSASSignatureValues,
- accountName);
-
- BlobServiceSasQueryParameters blobServiceSasQueryParameters =
- values.generateSASQueryParameters(userDelegationKey);
-
- return blobServiceSasQueryParameters.encode();
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param permissions The {@code BlobSASPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException if {@code sharedKeyCredential} is null
- */
- public String generateSAS(BlobSasPermission permissions, OffsetDateTime expiryTime) {
- return this.generateSAS(null, permissions, expiryTime, null /* startTime */, /* identifier */ null /*
- version */, null /* sasProtocol */, null /* ipRange */, null /* cacheControl */, null /* contentLanguage*/,
- null /* contentEncoding */, null /* contentLanguage */, null /* contentType */);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the container this SAS references if any
- * @return A string that represents the SAS token
- * @throws NullPointerException if {@code sharedKeyCredential} is null
- */
- public String generateSAS(String identifier) {
- return this.generateSAS(identifier, null /* permissions */, null /* expiryTime */, null /* startTime */,
- null /* version */, null /* sasProtocol */, null /* ipRange */, null /* cacheControl */, null /*
- contentLanguage*/, null /* contentEncoding */, null /* contentLanguage */, null /* contentType */);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the container this SAS references if any
- * @param permissions The {@code BlobSASPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException if {@code sharedKeyCredential} is null
- */
- public String generateSAS(String identifier, BlobSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange) {
- return this.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange, null
- /* cacheControl */, null /* contentLanguage*/, null /* contentEncoding */, null /* contentLanguage */,
- null /* contentType */);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.generateSAS#String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String}
- *
- * For more information, see the
- * Azure Docs
- *
- * @param identifier The {@code String} name of the access policy on the container this SAS references if any
- * @param permissions The {@code BlobSASPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param cacheControl An optional {@code String} cache-control header for the SAS.
- * @param contentDisposition An optional {@code String} content-disposition header for the SAS.
- * @param contentEncoding An optional {@code String} content-encoding header for the SAS.
- * @param contentLanguage An optional {@code String} content-language header for the SAS.
- * @param contentType An optional {@code String} content-type header for the SAS.
- * @return A string that represents the SAS token
- * @throws NullPointerException if {@code sharedKeyCredential} is null
- */
- public String generateSAS(String identifier, BlobSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange, String cacheControl,
- String contentDisposition, String contentEncoding, String contentLanguage, String contentType) {
-
- BlobServiceSasSignatureValues blobServiceSASSignatureValues = new BlobServiceSasSignatureValues(version,
- sasProtocol, startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange,
- identifier, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
-
- SharedKeyCredential sharedKeyCredential =
- Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline());
-
- Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential);
-
- BlobServiceSasSignatureValues values = configureServiceSASSignatureValues(blobServiceSASSignatureValues,
- sharedKeyCredential.getAccountName());
-
- BlobServiceSasQueryParameters blobServiceSasQueryParameters =
- values.generateSASQueryParameters(sharedKeyCredential);
-
- return blobServiceSasQueryParameters.encode();
- }
-
- /**
- * Sets blobServiceSASSignatureValues parameters dependent on the current blob type
- */
- private BlobServiceSasSignatureValues configureServiceSASSignatureValues(
- BlobServiceSasSignatureValues blobServiceSASSignatureValues, String accountName) {
-
- // Set canonical name
- blobServiceSASSignatureValues.setCanonicalName(this.azureBlobStorage.getUrl(), accountName);
-
- // Set snapshotId
- blobServiceSASSignatureValues.setSnapshotId(getSnapshotId());
-
- // Set resource
- if (isSnapshot()) {
- blobServiceSASSignatureValues.setResource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT);
- } else {
- blobServiceSASSignatureValues.setResource(Constants.UrlConstants.SAS_BLOB_CONSTANT);
- }
-
- return blobServiceSASSignatureValues;
- }
}
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 1af4ac625d7f..18bbb6774ae3 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
@@ -11,7 +11,6 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.BlobClient;
import com.azure.storage.blob.BlobProperties;
-import com.azure.storage.blob.BlobSasPermission;
import com.azure.storage.blob.models.AccessTier;
import com.azure.storage.blob.models.BlobAccessConditions;
import com.azure.storage.blob.models.BlobHTTPHeaders;
@@ -25,9 +24,6 @@
import com.azure.storage.blob.models.ReliableDownloadOptions;
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.blob.models.StorageException;
-import com.azure.storage.blob.models.UserDelegationKey;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
import reactor.core.publisher.Mono;
@@ -37,7 +33,6 @@
import java.net.URL;
import java.nio.file.FileAlreadyExistsException;
import java.time.Duration;
-import java.time.OffsetDateTime;
import java.util.Map;
/**
@@ -783,143 +778,4 @@ public Response getAccountInfoWithResponse(Duration timeout,
return Utility.blockWithOptionalTimeout(response, timeout);
}
-
- /**
- * Generates a user delegation SAS token with the specified parameters
- *
- * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS
- * @param accountName The {@code String} account name for the SAS
- * @param permissions The {@code BlobSASPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @return A string that represents the SAS token
- */
- public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName,
- BlobSasPermission permissions, OffsetDateTime expiryTime) {
- return this.client.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime);
- }
-
- /**
- * Generates a user delegation SAS token with the specified parameters
- *
- * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS
- * @param accountName The {@code String} account name for the SAS
- * @param permissions The {@code BlobSASPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- */
- public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName,
- BlobSasPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version,
- SASProtocol sasProtocol, IpRange ipRange) {
- return this.client.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime,
- startTime, version, sasProtocol, ipRange);
- }
-
- /**
- * Generates a user delegation SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.generateUserDelegationSAS#UserDelegationKey-String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String}
- *
- * For more information, see the
- * Azure
- * Docs
- *
- * @param userDelegationKey The {@code UserDelegationKey} user delegation key for the SAS
- * @param accountName The {@code String} account name for the SAS
- * @param permissions The {@code BlobSASPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param cacheControl An optional {@code String} cache-control header for the SAS.
- * @param contentDisposition An optional {@code String} content-disposition header for the SAS.
- * @param contentEncoding An optional {@code String} content-encoding header for the SAS.
- * @param contentLanguage An optional {@code String} content-language header for the SAS.
- * @param contentType An optional {@code String} content-type header for the SAS.
- * @return A string that represents the SAS token
- */
- public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName,
- BlobSasPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version,
- SASProtocol sasProtocol, IpRange ipRange, String cacheControl, String contentDisposition,
- String contentEncoding, String contentLanguage, String contentType) {
- return this.client.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime,
- startTime, version, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding,
- contentLanguage, contentType);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param permissions The {@code BlobSASPermission} permission for the SAS
- * @return A string that represents the SAS token
- */
- public String generateSAS(OffsetDateTime expiryTime, BlobSasPermission permissions) {
- return this.client.generateSAS(permissions, expiryTime);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the container this SAS references if any
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier) {
- return this.client.generateSAS(identifier);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the container this SAS references if any
- * @param permissions The {@code BlobSASPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier, BlobSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange) {
- return this.client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol,
- ipRange);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.generateSAS#String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String}
- *
- * For more information, see the
- * Azure Docs
- *
- * @param identifier The {@code String} name of the access policy on the container this SAS references if any
- * @param permissions The {@code BlobSASPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param cacheControl An optional {@code String} cache-control header for the SAS.
- * @param contentDisposition An optional {@code String} content-disposition header for the SAS.
- * @param contentEncoding An optional {@code String} content-encoding header for the SAS.
- * @param contentLanguage An optional {@code String} content-language header for the SAS.
- * @param contentType An optional {@code String} content-type header for the SAS.
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier, BlobSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange, String cacheControl,
- String contentDisposition, String contentEncoding, String contentLanguage, String contentType) {
- return this.client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol,
- ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- }
}
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobServiceSasSignatureValues.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobServiceSasSignatureValues.java
index 2b94450513c7..3f4187ad1d3a 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobServiceSasSignatureValues.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobServiceSasSignatureValues.java
@@ -195,14 +195,34 @@ public String getPermissions() {
}
/**
- * Sets the permissions string allowed by the SAS. Please refer to either {@link BlobContainerSasPermission} or
- * {@link BlobSasPermission} depending on the resource being accessed for help constructing the permissions string.
+ * Sets the Blob permissions allowed by the SAS.
*
- * @param permissions Permissions string for the SAS
+ * this will set the {@link #resource} to
+ * {@link com.azure.storage.common.Constants.UrlConstants#SAS_BLOB_CONSTANT}
+ * or {@link com.azure.storage.common.Constants.UrlConstants#SAS_BLOB_SNAPSHOT_CONSTANT} based on the value of
+ * {@link #getSnapshotId()}.
+ *
+ * @param permissions {@link BlobSasPermission}
* @return the updated BlobServiceSASSignatureValues object
*/
- public BlobServiceSasSignatureValues setPermissions(String permissions) {
- this.permissions = permissions;
+ public BlobServiceSasSignatureValues setPermissions(BlobSasPermission permissions) {
+ this.permissions = permissions.toString();
+ this.resource = Constants.UrlConstants.SAS_BLOB_CONSTANT;
+ return this;
+ }
+
+ /**
+ * Sets the Container permissions allowed by the SAS.
+ *
+ * this will set the {@link #resource} to
+ * {@link com.azure.storage.common.Constants.UrlConstants#SAS_CONTAINER_CONSTANT}.
+ *
+ * @param permissions {@link BlobContainerSasPermission}
+ * @return the updated BlobServiceSASSignatureValues object
+ */
+ public BlobServiceSasSignatureValues setPermissions(BlobContainerSasPermission permissions) {
+ this.permissions = permissions.toString();
+ this.resource = Constants.UrlConstants.SAS_CONTAINER_CONSTANT;
return this;
}
@@ -291,11 +311,19 @@ public String getSnapshotId() {
/**
* Sets the specific snapshot the SAS user may access.
*
+ * {@link #resource} will be set to
+ * {@link com.azure.storage.common.Constants.UrlConstants#SAS_BLOB_SNAPSHOT_CONSTANT} if the passed
+ * {@code snapshotId} isn't {@code null} and {@link #resource} is set to
+ * {@link com.azure.storage.common.Constants.UrlConstants#SAS_BLOB_CONSTANT}.
+ *
* @param snapshotId Identifier of the snapshot
* @return the updated BlobServiceSASSignatureValues object
*/
public BlobServiceSasSignatureValues setSnapshotId(String snapshotId) {
this.snapshotId = snapshotId;
+ if (snapshotId != null && Constants.UrlConstants.SAS_BLOB_CONSTANT.equals(resource)) {
+ this.resource = Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT;
+ }
return this;
}
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 34da7ccad6d2..f0a199d5294d 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
@@ -13,11 +13,7 @@
import com.azure.storage.blob.models.ParallelTransferOptions;
import com.azure.storage.blob.models.RehydratePriority;
import com.azure.storage.blob.models.ReliableDownloadOptions;
-import com.azure.storage.blob.models.UserDelegationKey;
import com.azure.storage.blob.specialized.BlobAsyncClientBase;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import reactor.core.publisher.Flux;
import java.io.ByteArrayOutputStream;
@@ -411,71 +407,6 @@ public void getAccountInfoWithResponseCodeSnippets() {
// END: com.azure.storage.blob.BlobAsyncClient.getAccountInfoWithResponse
}
- /**
- * Code snippet for {@link BlobAsyncClient#generateUserDelegationSAS(UserDelegationKey, String, BlobSasPermission,
- * OffsetDateTime, OffsetDateTime, String, SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateUserDelegationSASCodeSnippets() {
- // BEGIN: com.azure.storage.blob.BlobAsyncClient.generateUserDelegationSAS#UserDelegationKey-String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- BlobSasPermission permissions = new BlobSasPermission()
- .setReadPermission(true)
- .setWritePermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setAddPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- String accountName = "accountName";
- UserDelegationKey userDelegationKey = new UserDelegationKey();
-
- String sas = client.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime,
- startTime, version, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding,
- contentLanguage, contentType);
- // END: com.azure.storage.blob.BlobAsyncClient.generateUserDelegationSAS#UserDelegationKey-String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
- /**
- * Code snippet for {@link BlobAsyncClient#generateSAS(String, BlobSasPermission, OffsetDateTime, OffsetDateTime,
- * String, SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateSASCodeSnippets() {
- // BEGIN: com.azure.storage.blob.BlobAsyncClient.generateSAS#String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- BlobSasPermission permissions = new BlobSasPermission()
- .setReadPermission(true)
- .setWritePermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setAddPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String identifier = "identifier";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- // Note either "identifier", or "expiryTime and permissions" are required to be set
- String sas = client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange,
- cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- // END: com.azure.storage.blob.BlobAsyncClient.generateSAS#String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
/**
* Generates a code sample for using {@link BlobAsyncClient#getContainerName()}
*/
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 2f2b9b403ef0..fc7ab8622035 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,11 +15,8 @@
import com.azure.storage.blob.models.RehydratePriority;
import com.azure.storage.blob.models.ReliableDownloadOptions;
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.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -388,71 +385,6 @@ public void getAccountInfoWithResponseCodeSnippets() {
// END: com.azure.storage.blob.BlobClient.getAccountInfoWithResponse#Duration-Context
}
- /**
- * Code snippet for {@link BlobClient#generateUserDelegationSAS(UserDelegationKey, String, BlobSasPermission,
- * OffsetDateTime, OffsetDateTime, String, SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateUserDelegationSASCodeSnippets() {
- // BEGIN: com.azure.storage.blob.BlobClient.generateUserDelegationSAS#UserDelegationKey-String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- BlobSasPermission permissions = new BlobSasPermission()
- .setReadPermission(true)
- .setWritePermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setAddPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- UserDelegationKey userDelegationKey = new UserDelegationKey();
- String accountName = "accountName";
-
- String sas = client.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime,
- startTime, version, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding,
- contentLanguage, contentType);
- // END: com.azure.storage.blob.BlobClient.generateUserDelegationSAS#UserDelegationKey-String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
- /**
- * Code snippet for {@link BlobClient#generateSAS(String, BlobSasPermission, OffsetDateTime, OffsetDateTime, String,
- * SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateSASCodeSnippets() {
- // BEGIN: com.azure.storage.blob.BlobClient.generateSAS#String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- BlobSasPermission permissions = new BlobSasPermission()
- .setReadPermission(true)
- .setWritePermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setAddPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String identifier = "identifier";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- // Note either "identifier", or "expiryTime and permissions" are required to be set
- String sas = client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange,
- cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- // END: com.azure.storage.blob.BlobClient.generateSAS#String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
/**
* Generates a code sample for using {@link BlobClient#getContainerName()}
*/
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 79b7b0aa6773..1e9520302f9f 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
@@ -12,10 +12,6 @@
import com.azure.storage.blob.models.ModifiedAccessConditions;
import com.azure.storage.blob.models.PublicAccessType;
import com.azure.storage.blob.models.SignedIdentifier;
-import com.azure.storage.blob.models.UserDelegationKey;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import java.time.Duration;
import java.time.OffsetDateTime;
@@ -36,74 +32,6 @@ public class BlobContainerAsyncClientJavaDocCodeSnippets {
private String proposedId = "proposedId";
private int leaseDuration = (int) Duration.ofSeconds(30).getSeconds();
- /**
- * Code snippet for {@link BlobContainerAsyncClient#generateUserDelegationSAS(UserDelegationKey, String,
- * BlobContainerSasPermission, OffsetDateTime, OffsetDateTime, String, SASProtocol, IpRange, String, String, String,
- * String, String)}
- */
- public void generateUserDelegationSASCodeSnippets() {
- // BEGIN: com.azure.storage.blob.BlobContainerAsyncClient.generateUserDelegationSAS#UserDelegationKey-String-BlobContainerSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- BlobContainerSasPermission permissions = new BlobContainerSasPermission()
- .setReadPermission(true)
- .setWritePermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setAddPermission(true)
- .setListPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- String accountName = "accountName";
- UserDelegationKey userDelegationKey = new UserDelegationKey();
-
- String sas = client.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime,
- startTime, version, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding,
- contentLanguage, contentType);
- // END: com.azure.storage.blob.BlobContainerAsyncClient.generateUserDelegationSAS#UserDelegationKey-String-BlobContainerSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
- /**
- * Code snippet for {@link BlobContainerAsyncClient#generateSAS(String, BlobContainerSasPermission, OffsetDateTime,
- * OffsetDateTime, String, SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateSASCodeSnippets() {
- // BEGIN: com.azure.storage.blob.BlobContainerAsyncClient.generateSAS#String-BlobContainerSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- BlobContainerSasPermission permissions = new BlobContainerSasPermission()
- .setReadPermission(true)
- .setWritePermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setAddPermission(true)
- .setListPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String identifier = "identifier";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- // Note either "identifier", or "expiryTime and permissions" are required to be set
- String sas = client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange,
- cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- // END: com.azure.storage.blob.BlobContainerAsyncClient.generateSAS#String-BlobContainerSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
/**
* Code snippet for {@link BlobContainerAsyncClient#getBlobAsyncClient(String)}
*/
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 a26cdc9c76cc..743a4f8bd461 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
@@ -16,10 +16,6 @@
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.blob.models.StorageErrorCode;
import com.azure.storage.blob.models.StorageException;
-import com.azure.storage.blob.models.UserDelegationKey;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import java.time.Duration;
import java.time.OffsetDateTime;
@@ -38,74 +34,6 @@ public class BlobContainerClientJavaDocCodeSnippets {
private int leaseDuration = (int) Duration.ofSeconds(30).getSeconds();
private Duration timeout = Duration.ofSeconds(30);
- /**
- * Code snippet for {@link BlobContainerClient#generateUserDelegationSAS(UserDelegationKey, String,
- * BlobContainerSasPermission, OffsetDateTime, OffsetDateTime, String, SASProtocol, IpRange, String, String, String,
- * String, String)}
- */
- public void generateUserDelegationSASCodeSnippets() {
- // BEGIN: com.azure.storage.blob.BlobContainerClient.generateUserDelegationSAS#UserDelegationKey-String-BlobContainerSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- BlobContainerSasPermission permissions = new BlobContainerSasPermission()
- .setReadPermission(true)
- .setWritePermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setAddPermission(true)
- .setListPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- String accountName = "accountName";
- UserDelegationKey userDelegationKey = new UserDelegationKey();
-
- String sas = client.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime,
- startTime, version, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding,
- contentLanguage, contentType);
- // END: com.azure.storage.blob.BlobContainerClient.generateUserDelegationSAS#UserDelegationKey-String-BlobContainerSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
- /**
- * Code snippet for {@link BlobContainerClient#generateSAS(String, BlobContainerSasPermission, OffsetDateTime,
- * OffsetDateTime, String, SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateSASCodeSnippets() {
- // BEGIN: com.azure.storage.blob.BlobContainerClient.generateSAS#String-BlobContainerSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- BlobContainerSasPermission permissions = new BlobContainerSasPermission()
- .setReadPermission(true)
- .setWritePermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setAddPermission(true)
- .setListPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String identifier = "";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- // Note either "identifier", or "expiryTime and permissions" are required to be set
- String sas = client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange,
- cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- // END: com.azure.storage.blob.BlobContainerClient.generateSAS#String-BlobContainerSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
/**
* Code snippet for {@link BlobContainerClient#getBlobClient(String)}
*/
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 1473724a4806..b5b7a22ead5b 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,12 +11,6 @@
import com.azure.storage.blob.models.PublicAccessType;
import com.azure.storage.blob.models.RetentionPolicy;
import com.azure.storage.blob.models.StorageServiceProperties;
-import com.azure.storage.common.AccountSASPermission;
-import com.azure.storage.common.AccountSASResourceType;
-import com.azure.storage.common.AccountSASService;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.Map;
@@ -29,43 +23,6 @@ public class BlobServiceAsyncClientJavaDocCodeSnippets {
private BlobServiceAsyncClient client = JavaDocCodeSnippetsHelpers.getBlobServiceAsyncClient();
- /**
- * Generates a code sample for using {@link BlobServiceAsyncClient#generateAccountSAS(AccountSASService,
- * AccountSASResourceType, AccountSASPermission, OffsetDateTime, OffsetDateTime, String, IpRange, SASProtocol)}
- */
- public void generateAccountSAS() {
- // BEGIN: com.azure.storage.blob.blobServiceAsyncClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol
- AccountSASService service = new AccountSASService()
- .setBlob(true)
- .setFile(true)
- .setQueue(true)
- .setTable(true);
- AccountSASResourceType resourceType = new AccountSASResourceType()
- .setContainer(true)
- .setObject(true)
- .setService(true);
- AccountSASPermission permission = new AccountSASPermission()
- .setReadPermission(true)
- .setAddPermission(true)
- .setCreatePermission(true)
- .setWritePermission(true)
- .setDeletePermission(true)
- .setListPermission(true)
- .setProcessMessages(true)
- .setUpdatePermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- String sas = client.generateAccountSAS(service, resourceType, permission, expiryTime, startTime, version,
- ipRange, sasProtocol);
- // END: com.azure.storage.blob.blobServiceAsyncClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol
- }
-
/**
* Code snippet for {@link BlobServiceAsyncClient#getBlobContainerAsyncClient(String)}
*/
@@ -91,8 +48,9 @@ public void createContainer() {
public void createContainerWithResponse() {
// BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.createBlobContainerWithResponse#String-Map-PublicAccessType
Map metadata = Collections.singletonMap("metadata", "value");
- BlobContainerAsyncClient containerClient =
- client.createBlobContainerWithResponse("containerName", metadata, PublicAccessType.CONTAINER).block().getValue();
+
+ BlobContainerAsyncClient containerClient = client
+ .createBlobContainerWithResponse("containerName", metadata, PublicAccessType.CONTAINER).block().getValue();
// END: com.azure.storage.blob.BlobServiceAsyncClient.createBlobContainerWithResponse#String-Map-PublicAccessType
}
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 8ee24a5b5b23..acd4dc10390d 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,12 +12,7 @@
import com.azure.storage.blob.models.RetentionPolicy;
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.blob.models.StorageServiceProperties;
-import com.azure.storage.common.AccountSASPermission;
-import com.azure.storage.common.AccountSASResourceType;
-import com.azure.storage.common.AccountSASService;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
+
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.Collections;
@@ -31,43 +26,6 @@ public class BlobServiceClientJavaDocCodeSnippets {
private final BlobServiceClient client = JavaDocCodeSnippetsHelpers.getBlobServiceClient();
private final Duration timeout = Duration.ofSeconds(30);
- /**
- * Generates a code sample for using {@link BlobServiceClient#generateAccountSAS(AccountSASService,
- * AccountSASResourceType, AccountSASPermission, OffsetDateTime, OffsetDateTime, String, IpRange, SASProtocol)}
- */
- public void generateAccountSAS() {
- // BEGIN: com.azure.storage.blob.blobServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol
- AccountSASService service = new AccountSASService()
- .setBlob(true)
- .setFile(true)
- .setQueue(true)
- .setTable(true);
- AccountSASResourceType resourceType = new AccountSASResourceType()
- .setContainer(true)
- .setObject(true)
- .setService(true);
- AccountSASPermission permission = new AccountSASPermission()
- .setReadPermission(true)
- .setAddPermission(true)
- .setCreatePermission(true)
- .setWritePermission(true)
- .setDeletePermission(true)
- .setListPermission(true)
- .setProcessMessages(true)
- .setUpdatePermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- String sas = client.generateAccountSAS(service, resourceType, permission, expiryTime, startTime, version,
- ipRange, sasProtocol);
- // END: com.azure.storage.blob.blobServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol
- }
-
/**
* Code snippet for {@link BlobServiceClient#getBlobContainerClient(String)}
*/
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 d8c17072416a..03b5faa90702 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
@@ -3,7 +3,6 @@
package com.azure.storage.blob.specialized;
-import com.azure.storage.blob.BlobSasPermission;
import com.azure.storage.blob.models.AccessTier;
import com.azure.storage.blob.models.BlobAccessConditions;
import com.azure.storage.blob.models.BlobHTTPHeaders;
@@ -14,10 +13,6 @@
import com.azure.storage.blob.models.ParallelTransferOptions;
import com.azure.storage.blob.models.RehydratePriority;
import com.azure.storage.blob.models.ReliableDownloadOptions;
-import com.azure.storage.blob.models.UserDelegationKey;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -407,69 +402,4 @@ public void getAccountInfoWithResponseCodeSnippets() {
response.getValue().getAccountKind(), response.getValue().getSkuName()));
// END: com.azure.storage.blob.specialized.BlobAsyncClientBase.getAccountInfoWithResponse
}
-
- /**
- * Code snippet for {@link BlobAsyncClientBase#generateUserDelegationSAS(UserDelegationKey, String, BlobSasPermission,
- * OffsetDateTime, OffsetDateTime, String, SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateUserDelegationSASCodeSnippets() {
- // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.generateUserDelegationSAS#UserDelegationKey-String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- BlobSasPermission permissions = new BlobSasPermission()
- .setAddPermission(true)
- .setWritePermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setAddPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- String accountName = "accountName";
- UserDelegationKey userDelegationKey = new UserDelegationKey();
-
- String sas = client.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime,
- startTime, version, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding,
- contentLanguage, contentType);
- // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.generateUserDelegationSAS#UserDelegationKey-String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
- /**
- * Code snippet for {@link BlobAsyncClientBase#generateSAS(String, BlobSasPermission, OffsetDateTime, OffsetDateTime,
- * String, SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateSASCodeSnippets() {
- // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.generateSAS#String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- BlobSasPermission permissions = new BlobSasPermission()
- .setReadPermission(true)
- .setWritePermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setAddPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String identifier = "identifier";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- // Note either "identifier", or "expiryTime and permissions" are required to be set
- String sas = client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange,
- cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.generateSAS#String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
}
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 87fd7533d2a6..73bf9057425e 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
@@ -5,7 +5,6 @@
import com.azure.core.util.Context;
import com.azure.storage.blob.BlobProperties;
-import com.azure.storage.blob.BlobSasPermission;
import com.azure.storage.blob.models.AccessTier;
import com.azure.storage.blob.models.BlobAccessConditions;
import com.azure.storage.blob.models.BlobHTTPHeaders;
@@ -17,10 +16,7 @@
import com.azure.storage.blob.models.RehydratePriority;
import com.azure.storage.blob.models.ReliableDownloadOptions;
import com.azure.storage.blob.models.StorageAccountInfo;
-import com.azure.storage.blob.models.UserDelegationKey;
import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
@@ -393,69 +389,4 @@ 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(UserDelegationKey, String, BlobSasPermission,
- * OffsetDateTime, OffsetDateTime, String, SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateUserDelegationSASCodeSnippets() {
- // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.generateUserDelegationSAS#UserDelegationKey-String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- BlobSasPermission permissions = new BlobSasPermission()
- .setReadPermission(true)
- .setWritePermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setAddPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- UserDelegationKey userDelegationKey = new UserDelegationKey();
- String accountName = "accountName";
-
- String sas = client.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime,
- startTime, version, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding,
- contentLanguage, contentType);
- // END: com.azure.storage.blob.specialized.BlobClientBase.generateUserDelegationSAS#UserDelegationKey-String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
- /**
- * Code snippet for {@link BlobClientBase#generateSAS(String, BlobSasPermission, OffsetDateTime, OffsetDateTime, String,
- * SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateSASCodeSnippets() {
- // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.generateSAS#String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- BlobSasPermission permissions = new BlobSasPermission()
- .setReadPermission(true)
- .setWritePermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setAddPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String identifier = "identifier";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- // Note either "identifier", or "expiryTime and permissions" are required to be set
- String sas = client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange,
- cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- // END: com.azure.storage.blob.specialized.BlobClientBase.generateSAS#String-BlobSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
}
diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy
index c2643cd3f484..31f1601b4dac 100644
--- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy
+++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy
@@ -15,7 +15,6 @@ import com.azure.storage.blob.models.DeleteSnapshotsOptionType
import com.azure.storage.blob.models.LeaseAccessConditions
import com.azure.storage.blob.models.LeaseStateType
import com.azure.storage.blob.models.LeaseStatusType
-
import com.azure.storage.blob.models.ModifiedAccessConditions
import com.azure.storage.blob.models.PublicAccessType
import com.azure.storage.blob.models.RehydratePriority
@@ -24,6 +23,7 @@ import com.azure.storage.blob.models.StorageErrorCode
import com.azure.storage.blob.models.StorageException
import com.azure.storage.blob.models.SyncCopyStatusType
import com.azure.storage.blob.specialized.BlobClientBase
+import com.azure.storage.blob.specialized.BlobServiceSasSignatureValues
import com.azure.storage.blob.specialized.SpecializedBlobClientBuilder
import spock.lang.Unroll
@@ -1455,7 +1455,13 @@ class BlobAPITest extends APISpec {
def bcCopy = cc.getBlobClient(generateBlobName()).getBlockBlobClient()
when:
- bcCopy.copyFromURLWithResponse(new URL(bc.getBlobUrl() + "?" + bc.generateSAS(OffsetDateTime.now().plusHours(1), new BlobSasPermission().setReadPermission(true))), null, tier2, null, null, null, null)
+ def sas = new BlobServiceSasSignatureValues()
+ .setExpiryTime(OffsetDateTime.now().plusHours(1))
+ .setPermissions(new BlobSasPermission().setReadPermission(true))
+ .setCanonicalName(bc.getBlobUrl().toString(), primaryCredential.getAccountName())
+ .generateSASQueryParameters(primaryCredential)
+ .encode()
+ bcCopy.copyFromURLWithResponse(new URL(bc.getBlobUrl().toString() + "?" + sas), null, tier2, null, null, null, null)
then:
bcCopy.getProperties().getAccessTier() == tier2
diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/CPKTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/CPKTest.groovy
index 50dbf8541d4c..dd66b60a4c33 100644
--- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/CPKTest.groovy
+++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/CPKTest.groovy
@@ -2,10 +2,10 @@ package com.azure.storage.blob
import com.azure.core.http.policy.HttpLogDetailLevel
import com.azure.storage.blob.models.CustomerProvidedKey
-
import com.azure.storage.blob.models.PageRange
import com.azure.storage.blob.specialized.AppendBlobClient
import com.azure.storage.blob.specialized.BlobClientBase
+import com.azure.storage.blob.specialized.BlobServiceSasSignatureValues
import com.azure.storage.blob.specialized.BlockBlobClient
import com.azure.storage.blob.specialized.PageBlobClient
import com.azure.storage.common.Constants
@@ -92,8 +92,14 @@ class CPKTest extends APISpec {
sourceBlob.upload(defaultInputStream.get(), defaultDataSize)
when:
- def response = cpkBlockBlob.stageBlockFromURLWithResponse(getBlockID(),
- new URL(sourceBlob.getBlobUrl() + "?" + sourceBlob.generateSAS(OffsetDateTime.now().plusHours(1), new BlobSasPermission().setReadPermission(true))),
+ def sas = new BlobServiceSasSignatureValues()
+ .setExpiryTime(OffsetDateTime.now().plusHours(1))
+ .setPermissions(new BlobSasPermission().setReadPermission(true))
+ .setCanonicalName(sourceBlob.getBlobUrl().toString(), primaryCredential.getAccountName())
+ .generateSASQueryParameters(primaryCredential)
+ .encode()
+
+ def response = cpkBlockBlob.stageBlockFromURLWithResponse(getBlockID(), new URL(sourceBlob.getBlobUrl().toString() + "?" + sas),
null, null, null, null, null, null)
then:
@@ -141,9 +147,15 @@ class CPKTest extends APISpec {
cpkPageBlob.create(PageBlobClient.PAGE_BYTES)
when:
+ def sas = new BlobServiceSasSignatureValues()
+ .setExpiryTime(OffsetDateTime.now().plusHours(1))
+ .setPermissions(new BlobSasPermission().setReadPermission(true))
+ .setCanonicalName(sourceBlob.getBlobUrl().toString(), primaryCredential.getAccountName())
+ .generateSASQueryParameters(primaryCredential)
+ .encode()
+
def response = cpkPageBlob.uploadPagesFromURLWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1),
- new URL(sourceBlob.getBlobUrl() + "?" + sourceBlob.generateSAS(OffsetDateTime.now().plusHours(1), new BlobSasPermission().setReadPermission(true))),
- null, null, null, null, null, null)
+ new URL(sourceBlob.getBlobUrl().toString() + "?" + sas), null, null, null, null, null, null)
then:
response.getStatusCode() == 201
@@ -186,8 +198,13 @@ class CPKTest extends APISpec {
sourceBlob.upload(defaultInputStream.get(), defaultDataSize)
when:
- def response = cpkAppendBlob.appendBlockFromUrlWithResponse(
- new URL(sourceBlob.getBlobUrl() + "?" + sourceBlob.generateSAS(OffsetDateTime.now().plusHours(1), new BlobSasPermission().setReadPermission(true))),
+ def sas = new BlobServiceSasSignatureValues()
+ .setExpiryTime(OffsetDateTime.now().plusHours(1))
+ .setPermissions(new BlobSasPermission().setReadPermission(true))
+ .setCanonicalName(sourceBlob.getBlobUrl().toString(), primaryCredential.getAccountName())
+ .generateSASQueryParameters(primaryCredential)
+ .encode()
+ def response = cpkAppendBlob.appendBlockFromUrlWithResponse(new URL(sourceBlob.getBlobUrl().toString() + "?" + sas),
null, null, null, null, null, null)
then:
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 834f4d7be10b..3ff1e79a07d8 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
@@ -118,7 +118,21 @@ class SASTest extends APISpec {
def contentType = "type"
when:
- def sas = bu.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType)
+ def sas = new BlobServiceSasSignatureValues()
+ .setPermissions(permissions)
+ .setExpiryTime(expiryTime)
+ .setStartTime(startTime)
+ .setProtocol(sasProtocol)
+ .setIpRange(ipRange)
+ .setCacheControl(cacheControl)
+ .setContentDisposition(contentDisposition)
+ .setContentEncoding(contentEncoding)
+ .setContentLanguage(contentLanguage)
+ .setContentType(contentType)
+ .setCanonicalName(bu.getBlobUrl(), primaryCredential.getAccountName())
+ .setSnapshotId(bu.getSnapshotId())
+ .generateSASQueryParameters(primaryCredential)
+ .encode()
def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName).getBlockBlobClient()
@@ -165,7 +179,21 @@ class SASTest extends APISpec {
def contentType = "type"
when:
- def sas = snapshotBlob.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType)
+ def sas = new BlobServiceSasSignatureValues()
+ .setPermissions(permissions)
+ .setExpiryTime(expiryTime)
+ .setStartTime(startTime)
+ .setProtocol(sasProtocol)
+ .setIpRange(ipRange)
+ .setCacheControl(cacheControl)
+ .setContentDisposition(contentDisposition)
+ .setContentEncoding(contentEncoding)
+ .setContentLanguage(contentLanguage)
+ .setContentType(contentType)
+ .setCanonicalName(snapshotBlob.getBlobUrl(), primaryCredential.getAccountName())
+ .setSnapshotId(snapshotBlob.getSnapshotId())
+ .generateSASQueryParameters(primaryCredential)
+ .encode()
def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName, snapshotId).getBlockBlobClient()
@@ -202,13 +230,23 @@ class SASTest extends APISpec {
def expiryTime = getUTCNow().plusDays(1)
when:
- def sasWithId = cc.generateSAS(identifier.getId())
+ def sasWithId = new BlobServiceSasSignatureValues()
+ .setIdentifier(identifier.getId())
+ .setCanonicalName(cc.getBlobContainerUrl(), primaryCredential.getAccountName())
+ .setResource(Constants.UrlConstants.SAS_CONTAINER_CONSTANT)
+ .generateSASQueryParameters(primaryCredential)
+ .encode()
def client1 = getContainerClient(sasWithId, cc.getBlobContainerUrl())
client1.listBlobsFlat().iterator().hasNext()
- def sasWithPermissions = cc.generateSAS(permissions, expiryTime)
+ def sasWithPermissions = new BlobServiceSasSignatureValues()
+ .setPermissions(permissions)
+ .setExpiryTime(expiryTime)
+ .setCanonicalName(cc.getBlobContainerUrl().toString(), primaryCredential.getAccountName())
+ .generateSASQueryParameters(primaryCredential)
+ .encode()
def client2 = getContainerClient(sasWithPermissions, cc.getBlobContainerUrl())
@@ -251,7 +289,22 @@ class SASTest extends APISpec {
def key = getOAuthServiceClient().getUserDelegationKey(null, expiryTime)
when:
- def sas = bu.generateUserDelegationSAS(key, primaryCredential.getAccountName(), permissions, expiryTime, startTime, key.getSignedVersion(), sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType)
+ def sas = new BlobServiceSasSignatureValues()
+ .setPermissions(permissions)
+ .setExpiryTime(expiryTime)
+ .setStartTime(startTime)
+ .setProtocol(sasProtocol)
+ .setIpRange(ipRange)
+ .setCacheControl(cacheControl)
+ .setContentDisposition(contentDisposition)
+ .setContentEncoding(contentEncoding)
+ .setContentLanguage(contentLanguage)
+ .setContentType(contentType)
+ .setCanonicalName(bu.getBlobUrl().toString(), primaryCredential.getAccountName())
+ .setSnapshotId(bu.getSnapshotId())
+ .setVersion(key.getSignedVersion())
+ .generateSASQueryParameters(key)
+ .encode()
then:
sas != null
@@ -301,7 +354,21 @@ class SASTest extends APISpec {
def contentType = "type"
when:
- def sas = snapshotBlob.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType)
+ def sas = new BlobServiceSasSignatureValues()
+ .setPermissions(permissions)
+ .setExpiryTime(expiryTime)
+ .setStartTime(startTime)
+ .setProtocol(sasProtocol)
+ .setIpRange(ipRange)
+ .setCacheControl(cacheControl)
+ .setContentDisposition(contentDisposition)
+ .setContentEncoding(contentEncoding)
+ .setContentLanguage(contentLanguage)
+ .setContentType(contentType)
+ .setCanonicalName(snapshotBlob.getBlobUrl(), primaryCredential.getAccountName())
+ .setSnapshotId(snapshotBlob.getSnapshotId())
+ .generateSASQueryParameters(primaryCredential)
+ .encode()
and:
def client = getBlobClient(sas, containerClient.getBlobContainerUrl(), blobName).getAppendBlobClient()
@@ -366,7 +433,22 @@ class SASTest extends APISpec {
def key = getOAuthServiceClient().getUserDelegationKey(startTime, expiryTime)
when:
- def sas = snapshotBlob.generateUserDelegationSAS(key, primaryCredential.getAccountName(), permissions, expiryTime, startTime, key.getSignedVersion(), sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType)
+ def sas = new BlobServiceSasSignatureValues()
+ .setPermissions(permissions)
+ .setExpiryTime(expiryTime)
+ .setStartTime(startTime)
+ .setProtocol(sasProtocol)
+ .setIpRange(ipRange)
+ .setCacheControl(cacheControl)
+ .setContentDisposition(contentDisposition)
+ .setContentEncoding(contentEncoding)
+ .setContentLanguage(contentLanguage)
+ .setContentType(contentType)
+ .setCanonicalName(snapshotBlob.getBlobUrl().toString(), primaryCredential.getAccountName())
+ .setSnapshotId(snapshotBlob.getSnapshotId())
+ .setVersion(key.getSignedVersion())
+ .generateSASQueryParameters(key)
+ .encode()
// base blob with snapshot SAS
def client1 = getBlobClient(sas, cc.getBlobContainerUrl(), blobName).getBlockBlobClient()
@@ -412,7 +494,12 @@ class SASTest extends APISpec {
def key = getOAuthServiceClient().getUserDelegationKey(null, expiryTime)
when:
- def sasWithPermissions = cc.generateUserDelegationSAS(key, primaryCredential.getAccountName(), permissions, expiryTime)
+ def sasWithPermissions = new BlobServiceSasSignatureValues()
+ .setPermissions(permissions)
+ .setExpiryTime(expiryTime)
+ .setCanonicalName(cc.getBlobContainerUrl().toString(), primaryCredential.getAccountName())
+ .generateSASQueryParameters(key)
+ .encode()
def client = getContainerClient(sasWithPermissions, cc.getBlobContainerUrl())
client.listBlobsFlat().iterator().hasNext()
@@ -439,7 +526,7 @@ class SASTest extends APISpec {
def expiryTime = getUTCNow().plusDays(1)
when:
- def sas = primaryBlobServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null)
+ def sas = AccountSASSignatureValues.generateAccountSAS(primaryCredential, service, resourceType, permissions, expiryTime, null, null, null, null)
def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName).getBlockBlobClient()
def os = new ByteArrayOutputStream()
@@ -467,7 +554,7 @@ class SASTest extends APISpec {
def expiryTime = getUTCNow().plusDays(1)
when:
- def sas = primaryBlobServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null)
+ def sas = AccountSASSignatureValues.generateAccountSAS(primaryCredential, service, resourceType, permissions, expiryTime, null, null, null, null)
def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName).getBlockBlobClient()
client.delete()
@@ -490,7 +577,7 @@ class SASTest extends APISpec {
def expiryTime = getUTCNow().plusDays(1)
when:
- def sas = primaryBlobServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null)
+ def sas = AccountSASSignatureValues.generateAccountSAS(primaryCredential, service, resourceType, permissions, expiryTime, null, null, null, null)
def sc = getServiceClient(sas, primaryBlobServiceClient.getAccountUrl())
sc.createBlobContainer(generateContainerName())
@@ -513,7 +600,7 @@ class SASTest extends APISpec {
def expiryTime = getUTCNow().plusDays(1)
when:
- def sas = primaryBlobServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null)
+ def sas = AccountSASSignatureValues.generateAccountSAS(primaryCredential, service, resourceType, permissions, expiryTime, null, null, null, null)
def sc = getServiceClient(sas, primaryBlobServiceClient.getAccountUrl())
sc.createBlobContainer(generateContainerName())
@@ -534,7 +621,7 @@ class SASTest extends APISpec {
def v = new BlobServiceSasSignatureValues()
def p = new BlobSasPermission()
p.setReadPermission(true)
- v.setPermissions(p.toString())
+ v.setPermissions(p)
v.setStartTime(startTime)
def e = OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)
@@ -587,7 +674,7 @@ class SASTest extends APISpec {
def p = new BlobSasPermission()
p.setReadPermission(true)
- v.setPermissions(p.toString())
+ v.setPermissions(p)
v.setStartTime(startTime)
def e = OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)
@@ -825,11 +912,14 @@ class SASTest extends APISpec {
.setVersion(version)
.setCanonicalName(canonicalName)
.setExpiryTime(expiryTime)
- .setPermissions(permissions)
.setIdentifier(identifier)
.setResource(resource)
.setSnapshotId(snapshotId)
+ if (permissions != null) {
+ serviceSASSignatureValues.setPermissions(permissions)
+ }
+
if (usingUserDelegation) {
serviceSASSignatureValues.generateSASQueryParameters(new UserDelegationKey())
} else {
@@ -841,16 +931,15 @@ class SASTest extends APISpec {
thrown(NullPointerException)
where:
- usingUserDelegation | version | canonicalName | expiryTime | permissions | identifier | resource | snapshotId
- false | null | null | null | null | null | null | null
- false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | null | null | null | null | null | null
- false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | "containerName/blobName" | null | null | null | null | null
- false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | "containerName/blobName" | OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | null | null | null | null
- false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | "containerName/blobName" | null | new BlobSasPermission().setReadPermission(true).toString() | null | null | null
- false | null | null | null | null | "0000" | "c" | "id"
+ usingUserDelegation | version | canonicalName | expiryTime | permissions | identifier | resource | snapshotId
+ false | null | null | null | null | null | null | null
+ false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | null | null | null | null | null | null
+ false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | "containerName/blobName" | null | null | null | null | null
+ false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | "containerName/blobName" | OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | null | null | null | null
+ false | Constants.HeaderConstants.TARGET_STORAGE_VERSION | "containerName/blobName" | null | new BlobSasPermission().setReadPermission(true) | null | null | null
+ false | null | null | null | null | "0000" | "c" | "id"
}
- // TODO : Account SAS should go into the common package
/*
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
@@ -1035,7 +1124,7 @@ class SASTest extends APISpec {
.setBlobName("blob")
.setSnapshot("snapshot")
def sasValues = new BlobServiceSasSignatureValues()
- .setPermissions("r")
+ .setPermissions(new BlobSasPermission().setReadPermission(true))
.setCanonicalName("/containerName/blobName")
.setExpiryTime(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC))
.setResource("bs")
diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/HelperTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/HelperTest.groovy
index 7fa416b9809d..81223787366b 100644
--- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/HelperTest.groovy
+++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/HelperTest.groovy
@@ -88,9 +88,9 @@ class HelperTest extends APISpec {
when:
BlobServiceSasSignatureValues v = new BlobServiceSasSignatureValues()
if (permissions != null) {
- v.setPermissions(new BlobSasPermission().setReadPermission(true).toString())
+ v.setPermissions(new BlobSasPermission().setReadPermission(true))
} else {
- v.setPermissions("")
+ v.setPermissions(new BlobSasPermission())
}
if (snapId != null) {
@@ -164,9 +164,9 @@ class HelperTest extends APISpec {
when:
BlobServiceSasSignatureValues v = new BlobServiceSasSignatureValues()
if (permissions != null) {
- v.setPermissions(new BlobSasPermission().setReadPermission(true).toString())
+ v.setPermissions(new BlobSasPermission().setReadPermission(true))
} else {
- v.setPermissions("")
+ v.setPermissions(new BlobSasPermission())
}
v.setStartTime(startTime)
@@ -241,7 +241,7 @@ class HelperTest extends APISpec {
setup:
BlobServiceSasSignatureValues v = new BlobServiceSasSignatureValues()
.setExpiryTime(expiryTime)
- .setPermissions(new BlobSasPermission().toString())
+ .setPermissions(new BlobSasPermission())
.setResource(expectedResource)
.setCanonicalName(String.format("/blob/%s/%s", primaryCredential.getAccountName(), containerName))
.setSnapshotId(snapId)
@@ -272,8 +272,8 @@ class HelperTest extends APISpec {
@Unroll
def "serviceSasSignatureValues IA"() {
setup:
- BlobServiceSasSignatureValues v = new BlobServiceSasSignatureValues()
- .setPermissions(new AccountSASPermission().toString())
+ def v = new BlobServiceSasSignatureValues()
+ .setPermissions(new BlobSasPermission())
.setExpiryTime(OffsetDateTime.now())
.setResource(containerName)
.setCanonicalName(blobName)
@@ -635,7 +635,7 @@ class HelperTest extends APISpec {
BlobServiceSasSignatureValues sasValues = new BlobServiceSasSignatureValues()
.setExpiryTime(OffsetDateTime.now(ZoneOffset.UTC).plusDays(1))
- .setPermissions("r")
+ .setPermissions(new BlobSasPermission().setReadPermission(true))
.setCanonicalName(String.format("/blob/%s/container/blob", primaryCredential.getAccountName()))
.setResource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT)
diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainerfails.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainerfails.json
index cd2a35d5b50b..9dfb6f0dfcc2 100644
--- a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainerfails.json
+++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainerfails.json
@@ -1,32 +1,32 @@
{
"networkCallRecords" : [ {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails0864650c46ca24?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails098222916cc6dd?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "c771c2b0-9bd8-46fb-b3ba-71448ef567d3"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "7639f4cb-e2e7-4a4f-887e-039e93d62f40"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "ETag" : "\"0x8D7356020CDCD4C\"",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:47 GMT",
+ "ETag" : "\"0x8D7484124A8B9EF\"",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:52 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
- "x-ms-request-id" : "077fbbf4-801e-001f-0448-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:47 GMT",
- "x-ms-client-request-id" : "c771c2b0-9bd8-46fb-b3ba-71448ef567d3"
+ "x-ms-request-id" : "1ed03dae-f01e-00cd-662a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "7639f4cb-e2e7-4a4f-887e-039e93d62f40"
},
"Exception" : null
}, {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails1415220094cb8e?restype=container&sv=2019-02-02&ss=b&srt=sco&se=2019-09-10T19%3A58%3A48Z&sp=r&sig=REDACTED",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails135012fbc7d27b?restype=container&sv=2019-02-02&ss=b&srt=sco&se=2019-10-04T20%3A34%3A52Z&sp=r&sig=REDACTED",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "626eaf4b-7e6b-45a7-936d-58b805d43e87"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "41085bb5-ede6-4db9-9a82-0f9621d1594e"
},
"Response" : {
"x-ms-version" : "2019-02-02",
@@ -35,20 +35,20 @@
"retry-after" : "0",
"Content-Length" : "279",
"StatusCode" : "403",
- "x-ms-request-id" : "077fbc04-801e-001f-1248-673bbb000000",
- "Body" : "AuthorizationPermissionMismatchThis request is not authorized to perform this operation using this permission.\nRequestId:077fbc04-801e-001f-1248-673bbb000000\nTime:2019-09-09T19:58:48.0526009Z",
- "Date" : "Mon, 09 Sep 2019 19:58:47 GMT",
- "x-ms-client-request-id" : "626eaf4b-7e6b-45a7-936d-58b805d43e87",
+ "x-ms-request-id" : "1ed03dcb-f01e-00cd-802a-7a553e000000",
+ "Body" : "AuthorizationPermissionMismatchThis request is not authorized to perform this operation using this permission.\nRequestId:1ed03dcb-f01e-00cd-802a-7a553e000000\nTime:2019-10-03T20:34:52.1816531Z",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "41085bb5-ede6-4db9-9a82-0f9621d1594e",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasnetworkcreatecontainerfails&comp=list",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasnetworkcreatecontainerfails&comp=list",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "22d2903d-a6ce-465f-9d03-5c99ccf78f9f"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "d20ab1ca-3728-4a48-8102-9e6ea3e4f9a5"
},
"Response" : {
"Transfer-Encoding" : "chunked",
@@ -56,20 +56,20 @@
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "200",
- "x-ms-request-id" : "077fbc23-801e-001f-2c48-673bbb000000",
- "Body" : "jtcaccountsasnetworkcreatecontainerfailsjtcaccountsasnetworkcreatecontainerfails0864650c46ca24Mon, 09 Sep 2019 19:58:47 GMT\"0x8D7356020CDCD4C\"unlockedavailable$account-encryption-keyfalsefalsefalse",
- "Date" : "Mon, 09 Sep 2019 19:58:47 GMT",
- "x-ms-client-request-id" : "22d2903d-a6ce-465f-9d03-5c99ccf78f9f",
+ "x-ms-request-id" : "1ed03dda-f01e-00cd-0f2a-7a553e000000",
+ "Body" : "jtcaccountsasnetworkcreatecontainerfailsjtcaccountsasnetworkcreatecontainerfails098222916cc6ddThu, 03 Oct 2019 20:34:52 GMT\"0x8D7484124A8B9EF\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "d20ab1ca-3728-4a48-8102-9e6ea3e4f9a5",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "DELETE",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails0864650c46ca24?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails098222916cc6dd?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "fc012f87-629b-4d36-88e0-62a1f4ad6ce4"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "5d124be3-0195-4b6d-8f0e-2f64d7436884"
},
"Response" : {
"x-ms-version" : "2019-02-02",
@@ -77,11 +77,11 @@
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
- "x-ms-request-id" : "077fbc31-801e-001f-3a48-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:47 GMT",
- "x-ms-client-request-id" : "fc012f87-629b-4d36-88e0-62a1f4ad6ce4"
+ "x-ms-request-id" : "1ed03de8-f01e-00cd-1d2a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "5d124be3-0195-4b6d-8f0e-2f64d7436884"
},
"Exception" : null
} ],
- "variables" : [ "jtcaccountsasnetworkcreatecontainerfails0864650c46ca24", "2019-09-09T19:58:48.051Z", "jtcaccountsasnetworkcreatecontainerfails1415220094cb8e" ]
+ "variables" : [ "jtcaccountsasnetworkcreatecontainerfails098222916cc6dd", "2019-10-03T20:34:52.179008200Z", "jtcaccountsasnetworkcreatecontainerfails135012fbc7d27b" ]
}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainersucceeds.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainersucceeds.json
index 5067a7cc973e..097a9f6a5de9 100644
--- a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainersucceeds.json
+++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainersucceeds.json
@@ -1,53 +1,53 @@
{
"networkCallRecords" : [ {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds085024a04341c?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds0955816992d43?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "6993f61a-97cc-4b4b-9e5c-4c34feb934ed"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "fca3df1f-96fa-4cc6-a84c-92e458812bfb"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "ETag" : "\"0x8D73560210317EA\"",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:48 GMT",
+ "ETag" : "\"0x8D7484124C410D7\"",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:52 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
- "x-ms-request-id" : "077fbc40-801e-001f-4748-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:47 GMT",
- "x-ms-client-request-id" : "6993f61a-97cc-4b4b-9e5c-4c34feb934ed"
+ "x-ms-request-id" : "1ed03dfa-f01e-00cd-2e2a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "fca3df1f-96fa-4cc6-a84c-92e458812bfb"
},
"Exception" : null
}, {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds181802151c1ac?restype=container&sv=2019-02-02&ss=b&srt=sco&se=2019-09-10T19%3A58%3A48Z&sp=rc&sig=REDACTED",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds168048e7fdba3?restype=container&sv=2019-02-02&ss=b&srt=sco&se=2019-10-04T20%3A34%3A52Z&sp=rc&sig=REDACTED",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "afda5771-1286-47b5-9087-e535330e9bd5"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "20c9a56d-9b05-410e-836c-22392e872c92"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "ETag" : "\"0x8D735602110129A\"",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:48 GMT",
+ "ETag" : "\"0x8D7484124CB1770\"",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:52 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
- "x-ms-request-id" : "077fbc4d-801e-001f-5248-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:47 GMT",
- "x-ms-client-request-id" : "afda5771-1286-47b5-9087-e535330e9bd5"
+ "x-ms-request-id" : "1ed03e11-f01e-00cd-402a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "20c9a56d-9b05-410e-836c-22392e872c92"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasnetworkcreatecontainersucceeds&comp=list",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasnetworkcreatecontainersucceeds&comp=list",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "8f417ba9-34d1-4338-88cb-9da4aa6759f9"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "11c603dd-20e2-4e83-a8ae-f79dafa950a2"
},
"Response" : {
"Transfer-Encoding" : "chunked",
@@ -55,20 +55,20 @@
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "200",
- "x-ms-request-id" : "077fbc5a-801e-001f-5c48-673bbb000000",
- "Body" : "jtcaccountsasnetworkcreatecontainersucceedsjtcaccountsasnetworkcreatecontainersucceeds085024a04341cMon, 09 Sep 2019 19:58:48 GMT\"0x8D73560210317EA\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcaccountsasnetworkcreatecontainersucceeds181802151c1acMon, 09 Sep 2019 19:58:48 GMT\"0x8D735602110129A\"unlockedavailable$account-encryption-keyfalsefalsefalse",
- "Date" : "Mon, 09 Sep 2019 19:58:47 GMT",
- "x-ms-client-request-id" : "8f417ba9-34d1-4338-88cb-9da4aa6759f9",
+ "x-ms-request-id" : "1ed03e33-f01e-00cd-5b2a-7a553e000000",
+ "Body" : "jtcaccountsasnetworkcreatecontainersucceedsjtcaccountsasnetworkcreatecontainersucceeds0955816992d43Thu, 03 Oct 2019 20:34:52 GMT\"0x8D7484124C410D7\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcaccountsasnetworkcreatecontainersucceeds168048e7fdba3Thu, 03 Oct 2019 20:34:52 GMT\"0x8D7484124CB1770\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Thu, 03 Oct 2019 20:34:52 GMT",
+ "x-ms-client-request-id" : "11c603dd-20e2-4e83-a8ae-f79dafa950a2",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "DELETE",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds085024a04341c?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds0955816992d43?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "e27a57d6-2083-4e31-b155-60e394aca5e4"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "66c49f51-2cd1-437b-8a62-ad184612bc69"
},
"Response" : {
"x-ms-version" : "2019-02-02",
@@ -76,18 +76,18 @@
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
- "x-ms-request-id" : "077fbc6c-801e-001f-6c48-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:48 GMT",
- "x-ms-client-request-id" : "e27a57d6-2083-4e31-b155-60e394aca5e4"
+ "x-ms-request-id" : "1ed03e49-f01e-00cd-702a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:52 GMT",
+ "x-ms-client-request-id" : "66c49f51-2cd1-437b-8a62-ad184612bc69"
},
"Exception" : null
}, {
"Method" : "DELETE",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds181802151c1ac?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds168048e7fdba3?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "7cc59a12-4e74-45fe-9814-b91449b702b8"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "e8fda95d-25e9-4ebd-b69d-6a9b64b0c6db"
},
"Response" : {
"x-ms-version" : "2019-02-02",
@@ -95,11 +95,11 @@
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
- "x-ms-request-id" : "077fbc7b-801e-001f-7b48-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:48 GMT",
- "x-ms-client-request-id" : "7cc59a12-4e74-45fe-9814-b91449b702b8"
+ "x-ms-request-id" : "1ed03e6a-f01e-00cd-0b2a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:52 GMT",
+ "x-ms-client-request-id" : "e8fda95d-25e9-4ebd-b69d-6a9b64b0c6db"
},
"Exception" : null
} ],
- "variables" : [ "jtcaccountsasnetworkcreatecontainersucceeds085024a04341c", "2019-09-09T19:58:48.400Z", "jtcaccountsasnetworkcreatecontainersucceeds181802151c1ac" ]
+ "variables" : [ "jtcaccountsasnetworkcreatecontainersucceeds0955816992d43", "2019-10-03T20:34:52.346458900Z", "jtcaccountsasnetworkcreatecontainersucceeds168048e7fdba3" ]
}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobdeletefails.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobdeletefails.json
index 0ffc5cabecad..ee6e98f95443 100644
--- a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobdeletefails.json
+++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobdeletefails.json
@@ -1,57 +1,57 @@
{
"networkCallRecords" : [ {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails0523992ab2f48e1?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails06047960cc9decf?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "2f71364c-33fd-467a-84b6-2393135c8b85"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "69bb74f9-7a3b-425e-bfb1-7aca1e3c0646"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "ETag" : "\"0x8D73560208E208A\"",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:47 GMT",
+ "ETag" : "\"0x8D74841247FA409\"",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:51 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
- "x-ms-request-id" : "077fbbc2-801e-001f-5748-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:47 GMT",
- "x-ms-client-request-id" : "2f71364c-33fd-467a-84b6-2393135c8b85"
+ "x-ms-request-id" : "1ed03d15-f01e-00cd-672a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "69bb74f9-7a3b-425e-bfb1-7aca1e3c0646"
},
"Exception" : null
}, {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails0523992ab2f48e1/javablobaccountsasnetworktestblobdeletefails1483136b9f2e",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails06047960cc9decf/javablobaccountsasnetworktestblobdeletefails114020533621",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "e4263362-dccc-417a-a0e4-4f53ee26316c",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "cb9adf98-1b1c-4aa9-9b45-dcb97125d5d9",
"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, 09 Sep 2019 19:58:47 GMT",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:51 GMT",
"retry-after" : "0",
"StatusCode" : "201",
"x-ms-request-server-encrypted" : "true",
- "Date" : "Mon, 09 Sep 2019 19:58:47 GMT",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
"Content-MD5" : "CY9rzUYh03PK3k6DJie09g==",
- "ETag" : "\"0x8D73560209B4254\"",
+ "ETag" : "\"0x8D7484124885DEF\"",
"Content-Length" : "0",
- "x-ms-request-id" : "077fbbd3-801e-001f-6548-673bbb000000",
- "x-ms-client-request-id" : "e4263362-dccc-417a-a0e4-4f53ee26316c"
+ "x-ms-request-id" : "1ed03d33-f01e-00cd-802a-7a553e000000",
+ "x-ms-client-request-id" : "cb9adf98-1b1c-4aa9-9b45-dcb97125d5d9"
},
"Exception" : null
}, {
"Method" : "DELETE",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails0523992ab2f48e1/javablobaccountsasnetworktestblobdeletefails1483136b9f2e?sv=2019-02-02&ss=b&srt=sco&se=2019-09-10T19%3A58%3A47Z&sp=r&sig=REDACTED",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails06047960cc9decf/javablobaccountsasnetworktestblobdeletefails114020533621?sv=2019-02-02&ss=b&srt=sco&se=2019-10-04T20%3A34%3A51Z&sp=r&sig=REDACTED",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "662a20b8-404d-4b3a-b79a-f753f00e8370"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "f88cb540-342a-4caf-a3bd-e2cef1d347b3"
},
"Response" : {
"x-ms-version" : "2019-02-02",
@@ -60,20 +60,20 @@
"retry-after" : "0",
"Content-Length" : "279",
"StatusCode" : "403",
- "x-ms-request-id" : "077fbbdc-801e-001f-6e48-673bbb000000",
- "Body" : "AuthorizationPermissionMismatchThis request is not authorized to perform this operation using this permission.\nRequestId:077fbbdc-801e-001f-6e48-673bbb000000\nTime:2019-09-09T19:58:47.7223638Z",
- "Date" : "Mon, 09 Sep 2019 19:58:47 GMT",
- "x-ms-client-request-id" : "662a20b8-404d-4b3a-b79a-f753f00e8370",
+ "x-ms-request-id" : "1ed03d50-f01e-00cd-182a-7a553e000000",
+ "Body" : "AuthorizationPermissionMismatchThis request is not authorized to perform this operation using this permission.\nRequestId:1ed03d50-f01e-00cd-182a-7a553e000000\nTime:2019-10-03T20:34:51.9624428Z",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "f88cb540-342a-4caf-a3bd-e2cef1d347b3",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasnetworktestblobdeletefails&comp=list",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasnetworktestblobdeletefails&comp=list",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "685cde15-0d8a-4519-ace3-d2e8b9e1ab1e"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "0a8eb691-d87b-4801-9c12-4a4c972b5de1"
},
"Response" : {
"Transfer-Encoding" : "chunked",
@@ -81,20 +81,20 @@
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "200",
- "x-ms-request-id" : "077fbbe8-801e-001f-7848-673bbb000000",
- "Body" : "jtcaccountsasnetworktestblobdeletefailsjtcaccountsasnetworktestblobdeletefails0523992ab2f48e1Mon, 09 Sep 2019 19:58:47 GMT\"0x8D73560208E208A\"unlockedavailable$account-encryption-keyfalsefalsefalse",
- "Date" : "Mon, 09 Sep 2019 19:58:47 GMT",
- "x-ms-client-request-id" : "685cde15-0d8a-4519-ace3-d2e8b9e1ab1e",
+ "x-ms-request-id" : "1ed03d67-f01e-00cd-2d2a-7a553e000000",
+ "Body" : "jtcaccountsasnetworktestblobdeletefailsjtcaccountsasnetworktestblobdeletefails06047960cc9decfThu, 03 Oct 2019 20:34:51 GMT\"0x8D74841247FA409\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "0a8eb691-d87b-4801-9c12-4a4c972b5de1",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "DELETE",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails0523992ab2f48e1?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails06047960cc9decf?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "2a3fbc62-d10d-46b8-ae82-1eb672233ab8"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "55bb9b19-bfc9-473a-9407-390f258e3b90"
},
"Response" : {
"x-ms-version" : "2019-02-02",
@@ -102,11 +102,11 @@
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
- "x-ms-request-id" : "077fbbf2-801e-001f-0248-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:47 GMT",
- "x-ms-client-request-id" : "2a3fbc62-d10d-46b8-ae82-1eb672233ab8"
+ "x-ms-request-id" : "1ed03d91-f01e-00cd-4f2a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "55bb9b19-bfc9-473a-9407-390f258e3b90"
},
"Exception" : null
} ],
- "variables" : [ "jtcaccountsasnetworktestblobdeletefails0523992ab2f48e1", "javablobaccountsasnetworktestblobdeletefails1483136b9f2e", "2019-09-09T19:58:47.719Z" ]
+ "variables" : [ "jtcaccountsasnetworktestblobdeletefails06047960cc9decf", "javablobaccountsasnetworktestblobdeletefails114020533621", "2019-10-03T20:34:51.962903400Z" ]
}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobread.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobread.json
index 0d026afe8d26..7f731b36ba4d 100644
--- a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobread.json
+++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobread.json
@@ -1,88 +1,87 @@
{
"networkCallRecords" : [ {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobread005273c382c5ea5e3e?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobread010505d22cfb909832?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "02cbfcef-9d92-4578-a746-2e8560fa98a0"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "be595caf-c4a2-4821-be37-d18caec62340"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "ETag" : "\"0x8D73560203F07A0\"",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:47 GMT",
+ "ETag" : "\"0x8D748412459C33E\"",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:51 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
- "x-ms-request-id" : "077fbb70-801e-001f-0d48-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:46 GMT",
- "x-ms-client-request-id" : "02cbfcef-9d92-4578-a746-2e8560fa98a0"
+ "x-ms-request-id" : "1ed03c87-f01e-00cd-752a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "be595caf-c4a2-4821-be37-d18caec62340"
},
"Exception" : null
}, {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobread005273c382c5ea5e3e/javablobaccountsasnetworktestblobread1409227176455fc4",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobread010505d22cfb909832/javablobaccountsasnetworktestblobread117780fb62d19cf1",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "67df9187-5eb7-4ced-91b3-db67cdd23ada",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "897482ff-449d-4621-ad9a-75c92827a2d1",
"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, 09 Sep 2019 19:58:47 GMT",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:51 GMT",
"retry-after" : "0",
"StatusCode" : "201",
"x-ms-request-server-encrypted" : "true",
- "Date" : "Mon, 09 Sep 2019 19:58:46 GMT",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
"Content-MD5" : "CY9rzUYh03PK3k6DJie09g==",
- "ETag" : "\"0x8D73560205356AA\"",
+ "ETag" : "\"0x8D7484124614499\"",
"Content-Length" : "0",
- "x-ms-request-id" : "077fbb83-801e-001f-1f48-673bbb000000",
- "x-ms-client-request-id" : "67df9187-5eb7-4ced-91b3-db67cdd23ada"
+ "x-ms-request-id" : "1ed03c9e-f01e-00cd-062a-7a553e000000",
+ "x-ms-client-request-id" : "897482ff-449d-4621-ad9a-75c92827a2d1"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobread005273c382c5ea5e3e/javablobaccountsasnetworktestblobread1409227176455fc4?sv=2019-02-02&ss=b&srt=sco&se=2019-09-10T19%3A58%3A47Z&sp=r&sig=REDACTED",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobread010505d22cfb909832/javablobaccountsasnetworktestblobread117780fb62d19cf1?sv=2019-02-02&ss=b&srt=sco&se=2019-10-04T20%3A34%3A51Z&sp=r&sig=REDACTED",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "baac3248-df60-4582-a68a-245b3df13b68"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "9a27887f-8ee4-4cfa-a9fb-adbe91d84fb5"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"x-ms-lease-status" : "unlocked",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "x-ms-tag-count" : "0",
"x-ms-lease-state" : "available",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:47 GMT",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:51 GMT",
"retry-after" : "0",
"StatusCode" : "200",
- "Date" : "Mon, 09 Sep 2019 19:58:46 GMT",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
"x-ms-blob-type" : "BlockBlob",
"Content-MD5" : "CY9rzUYh03PK3k6DJie09g==",
"Accept-Ranges" : "bytes",
"x-ms-server-encrypted" : "true",
- "ETag" : "\"0x8D73560205356AA\"",
- "x-ms-creation-time" : "Mon, 09 Sep 2019 19:58:47 GMT",
+ "ETag" : "\"0x8D7484124614499\"",
+ "x-ms-creation-time" : "Thu, 03 Oct 2019 20:34:51 GMT",
"Content-Length" : "4",
- "x-ms-request-id" : "077fbb96-801e-001f-2e48-673bbb000000",
+ "x-ms-request-id" : "1ed03cbb-f01e-00cd-202a-7a553e000000",
"Body" : "[116, 101, 115, 116]",
- "x-ms-client-request-id" : "baac3248-df60-4582-a68a-245b3df13b68",
+ "x-ms-client-request-id" : "9a27887f-8ee4-4cfa-a9fb-adbe91d84fb5",
"Content-Type" : "application/octet-stream"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasnetworktestblobread&comp=list",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcaccountsasnetworktestblobread&comp=list",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "d05b47ab-c627-4f72-a432-210ef3ecd4f4"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "75e1ee55-90be-4498-9baf-7981b25b7b54"
},
"Response" : {
"Transfer-Encoding" : "chunked",
@@ -90,20 +89,20 @@
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "200",
- "x-ms-request-id" : "077fbbad-801e-001f-4448-673bbb000000",
- "Body" : "jtcaccountsasnetworktestblobreadjtcaccountsasnetworktestblobread005273c382c5ea5e3eMon, 09 Sep 2019 19:58:47 GMT\"0x8D73560203F07A0\"unlockedavailable$account-encryption-keyfalsefalsefalse",
- "Date" : "Mon, 09 Sep 2019 19:58:46 GMT",
- "x-ms-client-request-id" : "d05b47ab-c627-4f72-a432-210ef3ecd4f4",
+ "x-ms-request-id" : "1ed03cd7-f01e-00cd-392a-7a553e000000",
+ "Body" : "jtcaccountsasnetworktestblobreadjtcaccountsasnetworktestblobread010505d22cfb909832Thu, 03 Oct 2019 20:34:51 GMT\"0x8D748412459C33E\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "75e1ee55-90be-4498-9baf-7981b25b7b54",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "DELETE",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobread005273c382c5ea5e3e?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcaccountsasnetworktestblobread010505d22cfb909832?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "ba0f3769-961a-424e-b0e0-076369b375b5"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "53299507-b9ff-4cf6-8c5e-1f95e87fe361"
},
"Response" : {
"x-ms-version" : "2019-02-02",
@@ -111,11 +110,11 @@
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
- "x-ms-request-id" : "077fbbbc-801e-001f-5148-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:46 GMT",
- "x-ms-client-request-id" : "ba0f3769-961a-424e-b0e0-076369b375b5"
+ "x-ms-request-id" : "1ed03cf0-f01e-00cd-4a2a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "53299507-b9ff-4cf6-8c5e-1f95e87fe361"
},
"Exception" : null
} ],
- "variables" : [ "jtcaccountsasnetworktestblobread005273c382c5ea5e3e", "javablobaccountsasnetworktestblobread1409227176455fc4", "2019-09-09T19:58:47.285Z" ]
+ "variables" : [ "jtcaccountsasnetworktestblobread010505d22cfb909832", "javablobaccountsasnetworktestblobread117780fb62d19cf1", "2019-10-03T20:34:51.709167400Z" ]
}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobservicesasnetworktestblobsnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobservicesasnetworktestblobsnapshot.json
index 926576a060cb..d5098767a2d6 100644
--- a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobservicesasnetworktestblobsnapshot.json
+++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobservicesasnetworktestblobsnapshot.json
@@ -1,101 +1,101 @@
{
"networkCallRecords" : [ {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot090063b8550fc7?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot008074aacc125d?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "cde41189-880a-4f4f-88c4-15841c76e911"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "849b3f81-ec5c-46d7-8956-0cccfbc9cd63"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "ETag" : "\"0x8D735601FB5C15C\"",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:46 GMT",
+ "ETag" : "\"0x8D7484124094590\"",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:51 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
- "x-ms-request-id" : "077fbaf3-801e-001f-1b48-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:45 GMT",
- "x-ms-client-request-id" : "cde41189-880a-4f4f-88c4-15841c76e911"
+ "x-ms-request-id" : "1ed03b6d-f01e-00cd-0b2a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
+ "x-ms-client-request-id" : "849b3f81-ec5c-46d7-8956-0cccfbc9cd63"
},
"Exception" : null
}, {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot187339c10cc806?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot158813784f51d6?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "10a8e197-4c86-4d08-9593-9a702d3f4521"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "0b559db0-0676-4680-ad98-f206b44bf48c"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "ETag" : "\"0x8D735601FC2E320\"",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:46 GMT",
+ "ETag" : "\"0x8D7484124109A61\"",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:51 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
- "x-ms-request-id" : "077fbafb-801e-001f-2248-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:45 GMT",
- "x-ms-client-request-id" : "10a8e197-4c86-4d08-9593-9a702d3f4521"
+ "x-ms-request-id" : "1ed03b9e-f01e-00cd-312a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
+ "x-ms-client-request-id" : "0b559db0-0676-4680-ad98-f206b44bf48c"
},
"Exception" : null
}, {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot187339c10cc806/javablobblobservicesasnetworktestblobsnapshot268555a7e876",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot158813784f51d6/javablobblobservicesasnetworktestblobsnapshot24469591b681",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "120848c5-375d-429a-a26b-c676e4141ee3",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "cd32119f-224a-477a-901d-41031d2b5371",
"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, 09 Sep 2019 19:58:46 GMT",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:51 GMT",
"retry-after" : "0",
"StatusCode" : "201",
"x-ms-request-server-encrypted" : "true",
- "Date" : "Mon, 09 Sep 2019 19:58:45 GMT",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
"Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==",
- "ETag" : "\"0x8D735601FD0A145\"",
+ "ETag" : "\"0x8D7484124189178\"",
"Content-Length" : "0",
- "x-ms-request-id" : "077fbb06-801e-001f-2c48-673bbb000000",
- "x-ms-client-request-id" : "120848c5-375d-429a-a26b-c676e4141ee3"
+ "x-ms-request-id" : "1ed03bb8-f01e-00cd-442a-7a553e000000",
+ "x-ms-client-request-id" : "cd32119f-224a-477a-901d-41031d2b5371"
},
"Exception" : null
}, {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot187339c10cc806/javablobblobservicesasnetworktestblobsnapshot268555a7e876?comp=snapshot",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot158813784f51d6/javablobblobservicesasnetworktestblobsnapshot24469591b681?comp=snapshot",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "6654505d-cbe6-4f6d-9dd5-e725130b5163"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "f658637d-0844-477e-84dc-884b78643104"
},
"Response" : {
"x-ms-version" : "2019-02-02",
- "x-ms-snapshot" : "2019-09-09T19:58:46.3934129Z",
+ "x-ms-snapshot" : "2019-10-03T20:34:51.2399010Z",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "ETag" : "\"0x8D735601FD0A145\"",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:46 GMT",
+ "ETag" : "\"0x8D7484124189178\"",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:51 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
- "x-ms-request-id" : "077fbb10-801e-001f-3648-673bbb000000",
+ "x-ms-request-id" : "1ed03bd4-f01e-00cd-5c2a-7a553e000000",
"x-ms-request-server-encrypted" : "false",
- "Date" : "Mon, 09 Sep 2019 19:58:45 GMT",
- "x-ms-client-request-id" : "6654505d-cbe6-4f6d-9dd5-e725130b5163"
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
+ "x-ms-client-request-id" : "f658637d-0844-477e-84dc-884b78643104"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot187339c10cc806/javablobblobservicesasnetworktestblobsnapshot268555a7e876?sv=2019-02-02&spr=https%2Chttp&st=2019-09-08T19%3A58%3A46Z&se=2019-09-10T19%3A58%3A46Z&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",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot158813784f51d6/javablobblobservicesasnetworktestblobsnapshot24469591b681?sv=2019-02-02&spr=https%2Chttp&st=2019-10-02T20%3A34%3A51Z&se=2019-10-04T20%3A34%3A51Z&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.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "7b4ba01c-cbf2-43d1-b86f-2af5e5a922cb"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "407fead0-425c-46ac-a8fa-962f042a550f"
},
"Response" : {
"Server" : "Microsoft-HTTPAPI/2.0",
@@ -103,87 +103,83 @@
"retry-after" : "0",
"Content-Length" : "447",
"StatusCode" : "403",
- "x-ms-request-id" : "077fbb23-801e-001f-4648-673bbb000000",
- "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:077fbb23-801e-001f-4648-673bbb000000\nTime:2019-09-09T19:58:46.4774727ZThe specified signed resource is not allowed for the this resource level",
- "Date" : "Mon, 09 Sep 2019 19:58:45 GMT",
+ "x-ms-request-id" : "1ed03bfa-f01e-00cd-7c2a-7a553e000000",
+ "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:1ed03bfa-f01e-00cd-7c2a-7a553e000000\nTime:2019-10-03T20:34:51.3178255ZThe specified signed resource is not allowed for the this resource level",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot187339c10cc806/javablobblobservicesasnetworktestblobsnapshot268555a7e876?snapshot=2019-09-09T19%3a58%3a46.3934129Z&sv=2019-02-02&spr=https%2Chttp&st=2019-09-08T19%3A58%3A46Z&se=2019-09-10T19%3A58%3A46Z&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",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot158813784f51d6/javablobblobservicesasnetworktestblobsnapshot24469591b681?snapshot=2019-10-03T20%3a34%3a51.2399010Z&sv=2019-02-02&spr=https%2Chttp&st=2019-10-02T20%3A34%3A51Z&se=2019-10-04T20%3A34%3A51Z&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.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "12316e2e-d5e6-4ec5-bbe6-dab4db52032f"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "ea9a629b-8290-435a-a65e-5735f89736c6"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "x-ms-tag-count" : "0",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:46 GMT",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:51 GMT",
"retry-after" : "0",
"StatusCode" : "200",
- "Date" : "Mon, 09 Sep 2019 19:58:46 GMT",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
"x-ms-blob-type" : "BlockBlob",
"Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==",
"Accept-Ranges" : "bytes",
"x-ms-server-encrypted" : "true",
- "x-ms-snapshot" : "2019-09-09T19:58:46.3934129Z",
"Cache-Control" : "cache",
- "ETag" : "\"0x8D735601FD0A145\"",
+ "ETag" : "\"0x8D7484124189178\"",
"Content-Disposition" : "disposition",
- "x-ms-creation-time" : "Mon, 09 Sep 2019 19:58:46 GMT",
+ "x-ms-creation-time" : "Thu, 03 Oct 2019 20:34:51 GMT",
"Content-Length" : "7",
- "x-ms-request-id" : "077fbb2e-801e-001f-5148-673bbb000000",
+ "x-ms-request-id" : "1ed03c11-f01e-00cd-102a-7a553e000000",
"Body" : "default",
- "x-ms-client-request-id" : "12316e2e-d5e6-4ec5-bbe6-dab4db52032f",
+ "x-ms-client-request-id" : "ea9a629b-8290-435a-a65e-5735f89736c6",
"Content-Language" : "language",
"Content-Type" : "type"
},
"Exception" : null
}, {
"Method" : "HEAD",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot187339c10cc806/javablobblobservicesasnetworktestblobsnapshot268555a7e876?snapshot=2019-09-09T19%3a58%3a46.3934129Z&sv=2019-02-02&spr=https%2Chttp&st=2019-09-08T19%3A58%3A46Z&se=2019-09-10T19%3A58%3A46Z&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",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot158813784f51d6/javablobblobservicesasnetworktestblobsnapshot24469591b681?snapshot=2019-10-03T20%3a34%3a51.2399010Z&sv=2019-02-02&spr=https%2Chttp&st=2019-10-02T20%3A34%3A51Z&se=2019-10-04T20%3A34%3A51Z&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.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "214fe5f2-816b-400a-8448-f8a34302d62e"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "6d17f45f-5cdd-4a55-b264-3e03cb24c4cf"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "x-ms-tag-count" : "0",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:46 GMT",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:51 GMT",
"retry-after" : "0",
"StatusCode" : "200",
- "Date" : "Mon, 09 Sep 2019 19:58:46 GMT",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 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-snapshot" : "2019-09-09T19:58:46.3934129Z",
"x-ms-access-tier" : "Hot",
"Cache-Control" : "cache",
- "ETag" : "\"0x8D735601FD0A145\"",
+ "ETag" : "\"0x8D7484124189178\"",
"Content-Disposition" : "disposition",
"Content-Encoding" : "encoding",
- "x-ms-creation-time" : "Mon, 09 Sep 2019 19:58:46 GMT",
+ "x-ms-creation-time" : "Thu, 03 Oct 2019 20:34:51 GMT",
"Content-Length" : "7",
- "x-ms-request-id" : "077fbb41-801e-001f-6148-673bbb000000",
- "x-ms-client-request-id" : "214fe5f2-816b-400a-8448-f8a34302d62e",
+ "x-ms-request-id" : "1ed03c29-f01e-00cd-252a-7a553e000000",
+ "x-ms-client-request-id" : "6d17f45f-5cdd-4a55-b264-3e03cb24c4cf",
"Content-Language" : "language",
"Content-Type" : "type"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobservicesasnetworktestblobsnapshot&comp=list",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcblobservicesasnetworktestblobsnapshot&comp=list",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "dbabc1b4-d083-4114-bc18-5bebf07e0de9"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "0c0dc9ae-fcea-4c6b-99d3-d739209581ec"
},
"Response" : {
"Transfer-Encoding" : "chunked",
@@ -191,20 +187,20 @@
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "200",
- "x-ms-request-id" : "077fbb4e-801e-001f-6e48-673bbb000000",
- "Body" : "jtcblobservicesasnetworktestblobsnapshotjtcblobservicesasnetworktestblobsnapshot090063b8550fc7Mon, 09 Sep 2019 19:58:46 GMT\"0x8D735601FB5C15C\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcblobservicesasnetworktestblobsnapshot187339c10cc806Mon, 09 Sep 2019 19:58:46 GMT\"0x8D735601FC2E320\"unlockedavailable$account-encryption-keyfalsefalsefalse",
- "Date" : "Mon, 09 Sep 2019 19:58:46 GMT",
- "x-ms-client-request-id" : "dbabc1b4-d083-4114-bc18-5bebf07e0de9",
+ "x-ms-request-id" : "1ed03c40-f01e-00cd-372a-7a553e000000",
+ "Body" : "jtcblobservicesasnetworktestblobsnapshotjtcblobservicesasnetworktestblobsnapshot008074aacc125dThu, 03 Oct 2019 20:34:51 GMT\"0x8D7484124094590\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcblobservicesasnetworktestblobsnapshot158813784f51d6Thu, 03 Oct 2019 20:34:51 GMT\"0x8D7484124109A61\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "0c0dc9ae-fcea-4c6b-99d3-d739209581ec",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "DELETE",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot090063b8550fc7?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot008074aacc125d?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "1d22aa90-4adc-45f9-9c10-a0994a34a716"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "4060787e-3000-4d1b-970a-6eb8b1ac3c17"
},
"Response" : {
"x-ms-version" : "2019-02-02",
@@ -212,18 +208,18 @@
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
- "x-ms-request-id" : "077fbb5a-801e-001f-7a48-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:46 GMT",
- "x-ms-client-request-id" : "1d22aa90-4adc-45f9-9c10-a0994a34a716"
+ "x-ms-request-id" : "1ed03c52-f01e-00cd-462a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "4060787e-3000-4d1b-970a-6eb8b1ac3c17"
},
"Exception" : null
}, {
"Method" : "DELETE",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot187339c10cc806?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot158813784f51d6?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "af80d26d-15e2-472d-b382-4aec110a45c4"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "195b92be-b91f-4cd3-a2e4-6789298f1df4"
},
"Response" : {
"x-ms-version" : "2019-02-02",
@@ -231,11 +227,11 @@
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
- "x-ms-request-id" : "077fbb65-801e-001f-0448-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:46 GMT",
- "x-ms-client-request-id" : "af80d26d-15e2-472d-b382-4aec110a45c4"
+ "x-ms-request-id" : "1ed03c6e-f01e-00cd-5f2a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:51 GMT",
+ "x-ms-client-request-id" : "195b92be-b91f-4cd3-a2e4-6789298f1df4"
},
"Exception" : null
} ],
- "variables" : [ "jtcblobservicesasnetworktestblobsnapshot090063b8550fc7", "jtcblobservicesasnetworktestblobsnapshot187339c10cc806", "javablobblobservicesasnetworktestblobsnapshot268555a7e876", "2019-09-09T19:58:46.474Z", "2019-09-09T19:58:46.474Z" ]
+ "variables" : [ "jtcblobservicesasnetworktestblobsnapshot008074aacc125d", "jtcblobservicesasnetworktestblobsnapshot158813784f51d6", "javablobblobservicesasnetworktestblobsnapshot24469591b681", "2019-10-03T20:34:51.308964Z", "2019-10-03T20:34:51.308964Z" ]
}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblob.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblob.json
index e16c1372f9fe..62435a3708a4 100644
--- a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblob.json
+++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblob.json
@@ -1,127 +1,125 @@
{
"networkCallRecords" : [ {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob003141355f82b?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob01262372542f2?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "cfa961eb-6241-414a-a645-2b8d13996773"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "03325978-d4db-4d3f-bb33-8f7588902cb1"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "ETag" : "\"0x8D735601E9EEE1B\"",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "ETag" : "\"0x8D748412344DB00\"",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:49 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
- "x-ms-request-id" : "077fb9a7-801e-001f-6d48-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:43 GMT",
- "x-ms-client-request-id" : "cfa961eb-6241-414a-a645-2b8d13996773"
+ "x-ms-request-id" : "1ed03834-f01e-00cd-692a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:49 GMT",
+ "x-ms-client-request-id" : "03325978-d4db-4d3f-bb33-8f7588902cb1"
},
"Exception" : null
}, {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob003141355f82b/javablobservicesassignaturevaluesnetworktestblob178524a837",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob01262372542f2/javablobservicesassignaturevaluesnetworktestblob129798a7d7",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "5d7bce00-b7eb-4cfb-9d7e-4767765e0e1e",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "9a96d51a-8644-4c5b-aaca-5471575c3e0e",
"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, 09 Sep 2019 19:58:44 GMT",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:49 GMT",
"retry-after" : "0",
"StatusCode" : "201",
"x-ms-request-server-encrypted" : "true",
- "Date" : "Mon, 09 Sep 2019 19:58:43 GMT",
+ "Date" : "Thu, 03 Oct 2019 20:34:49 GMT",
"Content-MD5" : "CY9rzUYh03PK3k6DJie09g==",
- "ETag" : "\"0x8D735601EADBDE7\"",
+ "ETag" : "\"0x8D74841235AB97B\"",
"Content-Length" : "0",
- "x-ms-request-id" : "077fb9bd-801e-001f-0248-673bbb000000",
- "x-ms-client-request-id" : "5d7bce00-b7eb-4cfb-9d7e-4767765e0e1e"
+ "x-ms-request-id" : "1ed03884-f01e-00cd-312a-7a553e000000",
+ "x-ms-client-request-id" : "9a96d51a-8644-4c5b-aaca-5471575c3e0e"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob003141355f82b/javablobservicesassignaturevaluesnetworktestblob178524a837?sv=2019-02-02&spr=https%2Chttp&st=2019-09-08T19%3A58%3A44Z&se=2019-09-10T19%3A58%3A44Z&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",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob01262372542f2/javablobservicesassignaturevaluesnetworktestblob129798a7d7?sv=2019-02-02&spr=https%2Chttp&st=2019-10-02T20%3A34%3A50Z&se=2019-10-04T20%3A34%3A50Z&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.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "3621e8d1-07ad-4a77-9b32-0688da6a6c7c"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "d8279fb1-d595-4c24-8d2b-e920e951cd73"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"x-ms-lease-status" : "unlocked",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "x-ms-tag-count" : "0",
"x-ms-lease-state" : "available",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:49 GMT",
"retry-after" : "0",
"StatusCode" : "200",
- "Date" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "Date" : "Thu, 03 Oct 2019 20:34:49 GMT",
"x-ms-blob-type" : "BlockBlob",
"Content-MD5" : "CY9rzUYh03PK3k6DJie09g==",
"Accept-Ranges" : "bytes",
"x-ms-server-encrypted" : "true",
"Cache-Control" : "cache",
- "ETag" : "\"0x8D735601EADBDE7\"",
+ "ETag" : "\"0x8D74841235AB97B\"",
"Content-Disposition" : "disposition",
- "x-ms-creation-time" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "x-ms-creation-time" : "Thu, 03 Oct 2019 20:34:49 GMT",
"Content-Length" : "4",
- "x-ms-request-id" : "077fb9c8-801e-001f-0d48-673bbb000000",
+ "x-ms-request-id" : "1ed038bf-f01e-00cd-6a2a-7a553e000000",
"Body" : "test",
- "x-ms-client-request-id" : "3621e8d1-07ad-4a77-9b32-0688da6a6c7c",
+ "x-ms-client-request-id" : "d8279fb1-d595-4c24-8d2b-e920e951cd73",
"Content-Language" : "language",
"Content-Type" : "type"
},
"Exception" : null
}, {
"Method" : "HEAD",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob003141355f82b/javablobservicesassignaturevaluesnetworktestblob178524a837?sv=2019-02-02&spr=https%2Chttp&st=2019-09-08T19%3A58%3A44Z&se=2019-09-10T19%3A58%3A44Z&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",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob01262372542f2/javablobservicesassignaturevaluesnetworktestblob129798a7d7?sv=2019-02-02&spr=https%2Chttp&st=2019-10-02T20%3A34%3A50Z&se=2019-10-04T20%3A34%3A50Z&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.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "9954fa47-d98f-4a32-b1c0-0c4e08a86701"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "9d3cc2ed-79ef-43e7-894b-ae840c373813"
},
"Response" : {
+ "x-ms-version" : "2019-02-02",
"x-ms-lease-status" : "unlocked",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "x-ms-tag-count" : "0",
"x-ms-lease-state" : "available",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:49 GMT",
"retry-after" : "0",
"StatusCode" : "200",
+ "Date" : "Thu, 03 Oct 2019 20:34:49 GMT",
"x-ms-blob-type" : "BlockBlob",
- "x-ms-access-tier-inferred" : "true",
- "x-ms-access-tier" : "Hot",
- "Content-Encoding" : "encoding",
- "x-ms-creation-time" : "Mon, 09 Sep 2019 19:58:44 GMT",
- "Content-Length" : "4",
- "x-ms-request-id" : "077fb9e0-801e-001f-2248-673bbb000000",
- "Content-Type" : "type",
- "x-ms-version" : "2019-02-02",
- "Date" : "Mon, 09 Sep 2019 19:58:44 GMT",
"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" : "\"0x8D735601EADBDE7\"",
+ "ETag" : "\"0x8D74841235AB97B\"",
"Content-Disposition" : "disposition",
- "x-ms-client-request-id" : "9954fa47-d98f-4a32-b1c0-0c4e08a86701",
- "Content-Language" : "language"
+ "Content-Encoding" : "encoding",
+ "x-ms-creation-time" : "Thu, 03 Oct 2019 20:34:49 GMT",
+ "Content-Length" : "4",
+ "x-ms-request-id" : "1ed03909-f01e-00cd-1f2a-7a553e000000",
+ "x-ms-client-request-id" : "9d3cc2ed-79ef-43e7-894b-ae840c373813",
+ "Content-Language" : "language",
+ "Content-Type" : "type"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestblob&comp=list",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestblob&comp=list",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "f1d8ac90-a62f-494d-8b0b-d8944d4924c0"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "d0c3befb-eea4-42d8-850a-76d568f52b0a"
},
"Response" : {
"Transfer-Encoding" : "chunked",
@@ -129,20 +127,20 @@
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "200",
- "x-ms-request-id" : "077fb9e7-801e-001f-2948-673bbb000000",
- "Body" : "jtcservicesassignaturevaluesnetworktestblobjtcservicesassignaturevaluesnetworktestblob003141355f82bMon, 09 Sep 2019 19:58:44 GMT\"0x8D735601E9EEE1B\"unlockedavailable$account-encryption-keyfalsefalsefalse",
- "Date" : "Mon, 09 Sep 2019 19:58:44 GMT",
- "x-ms-client-request-id" : "f1d8ac90-a62f-494d-8b0b-d8944d4924c0",
+ "x-ms-request-id" : "1ed03932-f01e-00cd-3e2a-7a553e000000",
+ "Body" : "jtcservicesassignaturevaluesnetworktestblobjtcservicesassignaturevaluesnetworktestblob01262372542f2Thu, 03 Oct 2019 20:34:49 GMT\"0x8D748412344DB00\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Thu, 03 Oct 2019 20:34:49 GMT",
+ "x-ms-client-request-id" : "d0c3befb-eea4-42d8-850a-76d568f52b0a",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "DELETE",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob003141355f82b?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob01262372542f2?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "5b235243-b5b9-406d-bb86-bcc4a2b12faf"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "1637a1ec-8b0a-48de-98b8-b2adf66ae4c0"
},
"Response" : {
"x-ms-version" : "2019-02-02",
@@ -150,11 +148,11 @@
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
- "x-ms-request-id" : "077fb9f9-801e-001f-3a48-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:44 GMT",
- "x-ms-client-request-id" : "5b235243-b5b9-406d-bb86-bcc4a2b12faf"
+ "x-ms-request-id" : "1ed0395a-f01e-00cd-5c2a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:49 GMT",
+ "x-ms-client-request-id" : "1637a1ec-8b0a-48de-98b8-b2adf66ae4c0"
},
"Exception" : null
} ],
- "variables" : [ "jtcservicesassignaturevaluesnetworktestblob003141355f82b", "javablobservicesassignaturevaluesnetworktestblob178524a837", "2019-09-09T19:58:44.488Z", "2019-09-09T19:58:44.488Z" ]
+ "variables" : [ "jtcservicesassignaturevaluesnetworktestblob01262372542f2", "javablobservicesassignaturevaluesnetworktestblob129798a7d7", "2019-10-03T20:34:50.001180800Z", "2019-10-03T20:34:50.001180800Z" ]
}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobsnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobsnapshot.json
index ea02a54d1020..1f2b1e856a9f 100644
--- a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobsnapshot.json
+++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobsnapshot.json
@@ -1,148 +1,144 @@
{
"networkCallRecords" : [ {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot0657374b8?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot027008dbe?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "02a0a7e3-4b98-4dad-a4c7-f6f13e687507"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "128ba654-daf3-4f24-bda1-1052424d5efd"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "ETag" : "\"0x8D735601EF75789\"",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "ETag" : "\"0x8D74841238CF230\"",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:50 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
- "x-ms-request-id" : "077fba0d-801e-001f-4c48-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:44 GMT",
- "x-ms-client-request-id" : "02a0a7e3-4b98-4dad-a4c7-f6f13e687507"
+ "x-ms-request-id" : "1ed03979-f01e-00cd-772a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:49 GMT",
+ "x-ms-client-request-id" : "128ba654-daf3-4f24-bda1-1052424d5efd"
},
"Exception" : null
}, {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot0657374b8/javablobservicesassignaturevaluesnetworktestblobsnapshot127421",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot027008dbe/javablobservicesassignaturevaluesnetworktestblobsnapshot196664",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "28aa8177-e97e-4821-9098-bca5b45e2d87",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "f4d16bad-a985-47b3-bbe8-cece220b0051",
"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, 09 Sep 2019 19:58:44 GMT",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:50 GMT",
"retry-after" : "0",
"StatusCode" : "201",
"x-ms-request-server-encrypted" : "true",
- "Date" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "Date" : "Thu, 03 Oct 2019 20:34:49 GMT",
"Content-MD5" : "CY9rzUYh03PK3k6DJie09g==",
- "ETag" : "\"0x8D735601F06C3B1\"",
+ "ETag" : "\"0x8D7484123955F84\"",
"Content-Length" : "0",
- "x-ms-request-id" : "077fba1f-801e-001f-5c48-673bbb000000",
- "x-ms-client-request-id" : "28aa8177-e97e-4821-9098-bca5b45e2d87"
+ "x-ms-request-id" : "1ed039a3-f01e-00cd-182a-7a553e000000",
+ "x-ms-client-request-id" : "f4d16bad-a985-47b3-bbe8-cece220b0051"
},
"Exception" : null
}, {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot0657374b8/javablobservicesassignaturevaluesnetworktestblobsnapshot127421?comp=snapshot",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot027008dbe/javablobservicesassignaturevaluesnetworktestblobsnapshot196664?comp=snapshot",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "b2883df2-d1ac-48c1-8511-93d3c7e638d5"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "028980b0-41fb-4d1d-9557-9f966dc5adc3"
},
"Response" : {
"x-ms-version" : "2019-02-02",
- "x-ms-snapshot" : "2019-09-09T19:58:45.0714675Z",
+ "x-ms-snapshot" : "2019-10-03T20:34:50.3821011Z",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "ETag" : "\"0x8D735601F06C3B1\"",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "ETag" : "\"0x8D7484123955F84\"",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:50 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
- "x-ms-request-id" : "077fba31-801e-001f-6c48-673bbb000000",
+ "x-ms-request-id" : "1ed039c8-f01e-00cd-342a-7a553e000000",
"x-ms-request-server-encrypted" : "false",
- "Date" : "Mon, 09 Sep 2019 19:58:44 GMT",
- "x-ms-client-request-id" : "b2883df2-d1ac-48c1-8511-93d3c7e638d5"
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
+ "x-ms-client-request-id" : "028980b0-41fb-4d1d-9557-9f966dc5adc3"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot0657374b8/javablobservicesassignaturevaluesnetworktestblobsnapshot127421?snapshot=2019-09-09T19%3a58%3a45.0714675Z&sv=2019-02-02&spr=https%2Chttp&st=2019-09-08T19%3A58%3A45Z&se=2019-09-10T19%3A58%3A45Z&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",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot027008dbe/javablobservicesassignaturevaluesnetworktestblobsnapshot196664?snapshot=2019-10-03T20%3a34%3a50.3821011Z&sv=2019-02-02&spr=https%2Chttp&st=2019-10-02T20%3A34%3A50Z&se=2019-10-04T20%3A34%3A50Z&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.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "eaa14bd4-a77d-4e57-bb1a-e871185dc046"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "25898546-840e-4fd9-a43f-593cf71161e8"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "x-ms-tag-count" : "0",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:50 GMT",
"retry-after" : "0",
"StatusCode" : "200",
- "Date" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
"x-ms-blob-type" : "BlockBlob",
"Content-MD5" : "CY9rzUYh03PK3k6DJie09g==",
"Accept-Ranges" : "bytes",
"x-ms-server-encrypted" : "true",
- "x-ms-snapshot" : "2019-09-09T19:58:45.0714675Z",
"Cache-Control" : "cache",
- "ETag" : "\"0x8D735601F06C3B1\"",
+ "ETag" : "\"0x8D7484123955F84\"",
"Content-Disposition" : "disposition",
- "x-ms-creation-time" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "x-ms-creation-time" : "Thu, 03 Oct 2019 20:34:50 GMT",
"Content-Length" : "4",
- "x-ms-request-id" : "077fba3f-801e-001f-7948-673bbb000000",
+ "x-ms-request-id" : "1ed03a04-f01e-00cd-652a-7a553e000000",
"Body" : "test",
- "x-ms-client-request-id" : "eaa14bd4-a77d-4e57-bb1a-e871185dc046",
+ "x-ms-client-request-id" : "25898546-840e-4fd9-a43f-593cf71161e8",
"Content-Language" : "language",
"Content-Type" : "type"
},
"Exception" : null
}, {
"Method" : "HEAD",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot0657374b8/javablobservicesassignaturevaluesnetworktestblobsnapshot127421?snapshot=2019-09-09T19%3a58%3a45.0714675Z&sv=2019-02-02&spr=https%2Chttp&st=2019-09-08T19%3A58%3A45Z&se=2019-09-10T19%3A58%3A45Z&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",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot027008dbe/javablobservicesassignaturevaluesnetworktestblobsnapshot196664?snapshot=2019-10-03T20%3a34%3a50.3821011Z&sv=2019-02-02&spr=https%2Chttp&st=2019-10-02T20%3A34%3A50Z&se=2019-10-04T20%3A34%3A50Z&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.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "23bc32d5-4ea8-4c7f-ae58-dc749bcef191"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "f4dc6bca-547d-4da0-bf99-38d5d8d63de0"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "x-ms-tag-count" : "0",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:50 GMT",
"retry-after" : "0",
"StatusCode" : "200",
- "Date" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 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-snapshot" : "2019-09-09T19:58:45.0714675Z",
"x-ms-access-tier" : "Hot",
"Cache-Control" : "cache",
- "ETag" : "\"0x8D735601F06C3B1\"",
+ "ETag" : "\"0x8D7484123955F84\"",
"Content-Disposition" : "disposition",
"Content-Encoding" : "encoding",
- "x-ms-creation-time" : "Mon, 09 Sep 2019 19:58:44 GMT",
+ "x-ms-creation-time" : "Thu, 03 Oct 2019 20:34:50 GMT",
"Content-Length" : "4",
- "x-ms-request-id" : "077fba4a-801e-001f-0148-673bbb000000",
- "x-ms-client-request-id" : "23bc32d5-4ea8-4c7f-ae58-dc749bcef191",
+ "x-ms-request-id" : "1ed03a1d-f01e-00cd-7a2a-7a553e000000",
+ "x-ms-client-request-id" : "f4dc6bca-547d-4da0-bf99-38d5d8d63de0",
"Content-Language" : "language",
"Content-Type" : "type"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestblobsnapshot&comp=list",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestblobsnapshot&comp=list",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "24a49203-e429-4412-8df0-edbf4a4354ab"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "d0b92efd-c8fb-41a2-8b1d-6680b2155dca"
},
"Response" : {
"Transfer-Encoding" : "chunked",
@@ -150,20 +146,20 @@
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "200",
- "x-ms-request-id" : "077fba54-801e-001f-0948-673bbb000000",
- "Body" : "jtcservicesassignaturevaluesnetworktestblobsnapshotjtcservicesassignaturevaluesnetworktestblobsnapshot0657374b8Mon, 09 Sep 2019 19:58:44 GMT\"0x8D735601EF75789\"unlockedavailable$account-encryption-keyfalsefalsefalse",
- "Date" : "Mon, 09 Sep 2019 19:58:44 GMT",
- "x-ms-client-request-id" : "24a49203-e429-4412-8df0-edbf4a4354ab",
+ "x-ms-request-id" : "1ed03a33-f01e-00cd-0c2a-7a553e000000",
+ "Body" : "jtcservicesassignaturevaluesnetworktestblobsnapshotjtcservicesassignaturevaluesnetworktestblobsnapshot027008dbeThu, 03 Oct 2019 20:34:50 GMT\"0x8D74841238CF230\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
+ "x-ms-client-request-id" : "d0b92efd-c8fb-41a2-8b1d-6680b2155dca",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "DELETE",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot0657374b8?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot027008dbe?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "41ad8387-fd4b-4d4c-a416-7867a9d5e7e8"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "5fd5bc72-7587-4c19-b844-4d49496d7b5d"
},
"Response" : {
"x-ms-version" : "2019-02-02",
@@ -171,11 +167,11 @@
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
- "x-ms-request-id" : "077fba5e-801e-001f-1348-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:44 GMT",
- "x-ms-client-request-id" : "41ad8387-fd4b-4d4c-a416-7867a9d5e7e8"
+ "x-ms-request-id" : "1ed03a42-f01e-00cd-1a2a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
+ "x-ms-client-request-id" : "5fd5bc72-7587-4c19-b844-4d49496d7b5d"
},
"Exception" : null
} ],
- "variables" : [ "jtcservicesassignaturevaluesnetworktestblobsnapshot0657374b8", "javablobservicesassignaturevaluesnetworktestblobsnapshot127421", "2019-09-09T19:58:45.176Z", "2019-09-09T19:58:45.176Z" ]
+ "variables" : [ "jtcservicesassignaturevaluesnetworktestblobsnapshot027008dbe", "javablobservicesassignaturevaluesnetworktestblobsnapshot196664", "2019-10-03T20:34:50.476181200Z", "2019-10-03T20:34:50.476181200Z" ]
}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestcontainer.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestcontainer.json
index a265ba393322..98d9e8578b54 100644
--- a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestcontainer.json
+++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestcontainer.json
@@ -1,54 +1,54 @@
{
"networkCallRecords" : [ {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0643470cc9?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer04317616b6?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "676ae308-f1d9-4c94-9067-9871048bcf75"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "f67eae24-8748-4ee9-8799-0c69146f91fb"
},
"Response" : {
"x-ms-version" : "2019-02-02",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
- "ETag" : "\"0x8D735601F589C38\"",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:45 GMT",
+ "ETag" : "\"0x8D7484123CB6A11\"",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:50 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
- "x-ms-request-id" : "077fba68-801e-001f-1c48-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:45 GMT",
- "x-ms-client-request-id" : "676ae308-f1d9-4c94-9067-9871048bcf75"
+ "x-ms-request-id" : "1ed03a5e-f01e-00cd-332a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
+ "x-ms-client-request-id" : "f67eae24-8748-4ee9-8799-0c69146f91fb"
},
"Exception" : null
}, {
"Method" : "PUT",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0643470cc9?restype=container&comp=acl",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer04317616b6?restype=container&comp=acl",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "600345e0-15ee-4630-9a90-e841bd7a7e5e",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "1fb8ca6c-50f0-48bf-9abd-8c158f749df9",
"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" : "\"0x8D735601F71241E\"",
- "Last-Modified" : "Mon, 09 Sep 2019 19:58:45 GMT",
+ "ETag" : "\"0x8D7484123DAD463\"",
+ "Last-Modified" : "Thu, 03 Oct 2019 20:34:50 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "200",
- "x-ms-request-id" : "077fba94-801e-001f-4548-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:45 GMT",
- "x-ms-client-request-id" : "600345e0-15ee-4630-9a90-e841bd7a7e5e"
+ "x-ms-request-id" : "1ed03a98-f01e-00cd-602a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
+ "x-ms-client-request-id" : "1fb8ca6c-50f0-48bf-9abd-8c158f749df9"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0643470cc9?include=&restype=container&comp=list&sv=2019-02-02&si=0000&sr=c&sig=REDACTED",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer04317616b6?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.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "87e57f83-dfe7-43be-8be0-c5fa61b8f614"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "2ee78322-3395-444b-9ffb-2bef46e80daa"
},
"Response" : {
"Transfer-Encoding" : "chunked",
@@ -56,20 +56,20 @@
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "200",
- "x-ms-request-id" : "077fbaa3-801e-001f-5448-673bbb000000",
- "Body" : "",
- "Date" : "Mon, 09 Sep 2019 19:58:45 GMT",
- "x-ms-client-request-id" : "87e57f83-dfe7-43be-8be0-c5fa61b8f614",
+ "x-ms-request-id" : "1ed03ae2-f01e-00cd-1a2a-7a553e000000",
+ "Body" : "",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
+ "x-ms-client-request-id" : "2ee78322-3395-444b-9ffb-2bef46e80daa",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0643470cc9?include=&restype=container&comp=list&sv=2019-02-02&se=2019-09-10T19%3A58%3A45Z&sr=c&sp=racwdl&sig=REDACTED",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer04317616b6?include=&restype=container&comp=list&sv=2019-02-02&se=2019-10-04T20%3A34%3A50Z&sr=c&sp=racwdl&sig=REDACTED",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "c5ec45e9-f610-4112-9f70-957fe235b3a7"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "695b8651-d0b4-4f15-87e0-e5f6193b8975"
},
"Response" : {
"Transfer-Encoding" : "chunked",
@@ -77,20 +77,20 @@
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "200",
- "x-ms-request-id" : "077fbabd-801e-001f-6b48-673bbb000000",
- "Body" : "",
- "Date" : "Mon, 09 Sep 2019 19:58:45 GMT",
- "x-ms-client-request-id" : "c5ec45e9-f610-4112-9f70-957fe235b3a7",
+ "x-ms-request-id" : "1ed03afe-f01e-00cd-322a-7a553e000000",
+ "Body" : "",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
+ "x-ms-client-request-id" : "695b8651-d0b4-4f15-87e0-e5f6193b8975",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "GET",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestcontainer&comp=list",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestcontainer&comp=list",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "1ac8fa41-e2ce-4ebd-8824-acd1ca337ada"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "cb5f5ebe-69a2-40d3-8aca-aa1b3e0516d1"
},
"Response" : {
"Transfer-Encoding" : "chunked",
@@ -98,20 +98,20 @@
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "200",
- "x-ms-request-id" : "077fbacc-801e-001f-7648-673bbb000000",
- "Body" : "jtcservicesassignaturevaluesnetworktestcontainerjtcservicesassignaturevaluesnetworktestcontainer0643470cc9Mon, 09 Sep 2019 19:58:45 GMT\"0x8D735601F71241E\"unlockedavailable$account-encryption-keyfalsefalsefalse",
- "Date" : "Mon, 09 Sep 2019 19:58:45 GMT",
- "x-ms-client-request-id" : "1ac8fa41-e2ce-4ebd-8824-acd1ca337ada",
+ "x-ms-request-id" : "1ed03b1c-f01e-00cd-4b2a-7a553e000000",
+ "Body" : "jtcservicesassignaturevaluesnetworktestcontainerjtcservicesassignaturevaluesnetworktestcontainer04317616b6Thu, 03 Oct 2019 20:34:50 GMT\"0x8D7484123DAD463\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
+ "x-ms-client-request-id" : "cb5f5ebe-69a2-40d3-8aca-aa1b3e0516d1",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "DELETE",
- "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0643470cc9?restype=container",
+ "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer04317616b6?restype=container",
"Headers" : {
"x-ms-version" : "2019-02-02",
- "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0",
- "x-ms-client-request-id" : "3d9a94ad-9ab3-4589-8720-65107a918370"
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.4 11.0.4; Windows 10 10.0",
+ "x-ms-client-request-id" : "87a9ce16-c038-4117-93bc-c0bd2d85a7d9"
},
"Response" : {
"x-ms-version" : "2019-02-02",
@@ -119,11 +119,11 @@
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
- "x-ms-request-id" : "077fbada-801e-001f-0448-673bbb000000",
- "Date" : "Mon, 09 Sep 2019 19:58:45 GMT",
- "x-ms-client-request-id" : "3d9a94ad-9ab3-4589-8720-65107a918370"
+ "x-ms-request-id" : "1ed03b38-f01e-00cd-602a-7a553e000000",
+ "Date" : "Thu, 03 Oct 2019 20:34:50 GMT",
+ "x-ms-client-request-id" : "87a9ce16-c038-4117-93bc-c0bd2d85a7d9"
},
"Exception" : null
} ],
- "variables" : [ "jtcservicesassignaturevaluesnetworktestcontainer0643470cc9", "2019-09-09T19:58:45.639Z", "2019-09-09T19:58:45.775Z" ]
+ "variables" : [ "jtcservicesassignaturevaluesnetworktestcontainer04317616b6", "2019-10-03T20:34:50.731565200Z", "2019-10-03T20:34:50.845196800Z" ]
}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java
index e399835a6204..6af096fe948d 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java
@@ -13,9 +13,6 @@
import com.azure.core.implementation.util.FluxUtil;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.implementation.AzureFileStorageImpl;
@@ -1097,116 +1094,6 @@ public String getShareSnapshotId() {
return this.snapshot;
}
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param permissions The {@code FileSasPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredentials} is null
- */
- public String generateSAS(FileSasPermission permissions, OffsetDateTime expiryTime) {
- return this.generateSAS(null, permissions, expiryTime, null /* startTime */, /* identifier */ null /*
- version */, null /* sasProtocol */, null /* ipRange */, null /* cacheControl */, null /* contentLanguage*/,
- null /* contentEncoding */, null /* contentLanguage */, null /* contentType */);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the share this SAS references if any
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredentials} is null
- */
- public String generateSAS(String identifier) {
- return this.generateSAS(identifier, null /* permissions */, null /* expiryTime */, null /* startTime */,
- null /* version */, null /* sasProtocol */, null /* ipRange */, null /* cacheControl */, null /*
- contentLanguage*/, null /* contentEncoding */, null /* contentLanguage */, null /* contentType */);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the share this SAS references if any
- * @param permissions The {@code FileSasPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredentials} is null
- */
- public String generateSAS(String identifier, FileSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange) {
- return this.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange, null
- /* cacheControl */, null /* contentLanguage*/, null /* contentEncoding */, null /* contentLanguage */,
- null /* contentType */);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.file.fileAsyncClient.generateSAS#String-FileSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String}
- *
- * For more information, see the
- * Azure Docs.
- *
- * @param identifier The {@code String} name of the access policy on the share this SAS references if any
- * @param permissions The {@code FileSasPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param cacheControl An optional {@code String} cache-control header for the SAS.
- * @param contentDisposition An optional {@code String} content-disposition header for the SAS.
- * @param contentEncoding An optional {@code String} content-encoding header for the SAS.
- * @param contentLanguage An optional {@code String} content-language header for the SAS.
- * @param contentType An optional {@code String} content-type header for the SAS.
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredentials} is null
- */
- public String generateSAS(String identifier, FileSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange,
- String cacheControl, String contentDisposition, String contentEncoding,
- String contentLanguage, String contentType) {
-
- FileServiceSasSignatureValues fileServiceSASSignatureValues = new FileServiceSasSignatureValues(version,
- sasProtocol, startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange,
- identifier, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
-
- SharedKeyCredential sharedKeyCredential =
- Utility.getSharedKeyCredential(this.azureFileStorageClient.getHttpPipeline());
-
- Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential);
-
- FileServiceSasSignatureValues values = configureServiceSASSignatureValues(fileServiceSASSignatureValues,
- sharedKeyCredential.getAccountName());
-
- FileServiceSasQueryParameters fileServiceSasQueryParameters =
- values.generateSASQueryParameters(sharedKeyCredential);
-
- return fileServiceSasQueryParameters.encode();
- }
-
- /**
- * Sets fileServiceSASSignatureValues parameters dependent on the current file type
- */
- FileServiceSasSignatureValues configureServiceSASSignatureValues(
- FileServiceSasSignatureValues fileServiceSASSignatureValues, String accountName) {
-
- // Set canonical name
- fileServiceSASSignatureValues.setCanonicalName(this.shareName, this.filePath, accountName);
-
- // Set resource
- fileServiceSASSignatureValues.setResource(Constants.UrlConstants.SAS_FILE_CONSTANT);
-
- return fileServiceSASSignatureValues;
- }
-
/**
* Get the share name of file client.
*
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java
index 0dbc2eeca6ca..082857cf1893 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java
@@ -7,8 +7,6 @@
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.models.FileCopyInfo;
@@ -29,7 +27,6 @@
import java.nio.ByteBuffer;
import java.nio.file.FileAlreadyExistsException;
import java.time.Duration;
-import java.time.OffsetDateTime;
import java.util.Map;
/**
@@ -856,76 +853,6 @@ public String getShareSnapshotId() {
return fileAsyncClient.getShareSnapshotId();
}
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param permissions The {@code FileSasPermission} permission for the SAS
- * @return A string that represents the SAS token
- */
- public String generateSAS(OffsetDateTime expiryTime, FileSasPermission permissions) {
- return this.fileAsyncClient.generateSAS(permissions, expiryTime);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the share this SAS references if any
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier) {
- return this.fileAsyncClient.generateSAS(identifier);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the share this SAS references if any
- * @param permissions The {@code FileSasPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier, FileSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange) {
- return this.fileAsyncClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol,
- ipRange);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.file.FileClient.generateSAS#String-FileSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String}
- *
- * For more information, see the
- * Azure Docs.
- *
- * @param identifier The {@code String} name of the access policy on the share this SAS references if any
- * @param permissions The {@code FileSasPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param cacheControl An optional {@code String} cache-control header for the SAS.
- * @param contentDisposition An optional {@code String} content-disposition header for the SAS.
- * @param contentEncoding An optional {@code String} content-encoding header for the SAS.
- * @param contentLanguage An optional {@code String} content-language header for the SAS.
- * @param contentType An optional {@code String} content-type header for the SAS.
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier, FileSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange, String cacheControl,
- String contentDisposition, String contentEncoding, String contentLanguage, String contentType) {
- return this.fileAsyncClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol,
- ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- }
-
/**
* Get the share name of file client.
*
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java
index 1ee25a7e2dc7..f6b016f8acfc 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java
@@ -13,12 +13,6 @@
import com.azure.core.implementation.util.ImplUtils;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
-import com.azure.storage.common.AccountSASPermission;
-import com.azure.storage.common.AccountSASResourceType;
-import com.azure.storage.common.AccountSASService;
-import com.azure.storage.common.AccountSASSignatureValues;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.implementation.AzureFileStorageImpl;
@@ -32,7 +26,6 @@
import reactor.core.publisher.Mono;
import java.time.Duration;
-import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -437,53 +430,4 @@ Mono> deleteShareWithResponse(String shareName, String snapshot,
.deleteWithRestResponseAsync(shareName, snapshot, null, deleteSnapshots, context))
.map(response -> new SimpleResponse<>(response, null));
}
-
- /**
- * Generates an account SAS token with the specified parameters
- *
- * @param accountSASService The {@code AccountSASService} services for the account SAS
- * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS
- * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredentials} is null
- */
- public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType,
- AccountSASPermission accountSASPermission, OffsetDateTime expiryTime) {
- return this.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime,
- null /* startTime */, null /* version */, null /* ipRange */, null /* sasProtocol */);
- }
-
- /**
- * Generates an account SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.file.FileServiceAsyncClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol}
- *
- * For more information, see the
- * Azure Docs.
- *
- * @param accountSASService The {@code AccountSASService} services for the account SAS
- * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS
- * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS
- * @param startTime The {@code OffsetDateTime} start time for the account SAS
- * @param version The {@code String} version for the account SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredentials} is null
- */
- public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType,
- AccountSASPermission accountSASPermission, OffsetDateTime expiryTime, OffsetDateTime startTime,
- String version, IpRange ipRange, SASProtocol sasProtocol) {
-
- SharedKeyCredential sharedKeyCredential = Utility.getSharedKeyCredential(this.azureFileStorageClient
- .getHttpPipeline());
- Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential);
-
- return AccountSASSignatureValues.generateAccountSAS(sharedKeyCredential, accountSASService,
- accountSASResourceType, accountSASPermission, expiryTime, startTime, version, ipRange, sasProtocol);
- }
}
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java
index f53293b6aa99..0f0e2448b640 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java
@@ -8,11 +8,6 @@
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
-import com.azure.storage.common.AccountSASPermission;
-import com.azure.storage.common.AccountSASResourceType;
-import com.azure.storage.common.AccountSASService;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.models.CorsRule;
@@ -23,7 +18,6 @@
import reactor.core.publisher.Mono;
import java.time.Duration;
-import java.time.OffsetDateTime;
import java.util.Map;
/**
@@ -364,46 +358,4 @@ public Response deleteShareWithResponse(String shareName, String snapshot,
Mono> response = fileServiceAsyncClient.deleteShareWithResponse(shareName, snapshot, context);
return Utility.blockWithOptionalTimeout(response, timeout);
}
-
- /**
- * Generates an account SAS token with the specified parameters
- *
- * @param accountSASService The {@code AccountSASService} services for the account SAS
- * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS
- * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS
- * @return A string that represents the SAS token
- */
- public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType,
- AccountSASPermission accountSASPermission, OffsetDateTime expiryTime) {
- return this.fileServiceAsyncClient
- .generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime);
- }
-
- /**
- * Generates an account SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.file.FileServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol}
- *
- * For more information, see the
- * Azure Docs.
- *
- * @param accountSASService The {@code AccountSASService} services for the account SAS
- * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS
- * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS
- * @param startTime The {@code OffsetDateTime} start time for the account SAS
- * @param version The {@code String} version for the account SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @return A string that represents the SAS token
- */
- public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType,
- AccountSASPermission accountSASPermission, OffsetDateTime expiryTime, OffsetDateTime startTime,
- String version, IpRange ipRange, SASProtocol sasProtocol) {
- return this.fileServiceAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType,
- accountSASPermission, expiryTime, startTime, version, ipRange, sasProtocol);
- }
}
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSasSignatureValues.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSasSignatureValues.java
index e3aa5bee1f36..4ff46fcff2ac 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSasSignatureValues.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSasSignatureValues.java
@@ -28,7 +28,7 @@
* here
* for additional samples.
*/
-final class FileServiceSasSignatureValues {
+public final class FileServiceSasSignatureValues {
private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java
index 3346b33356f9..e07cb6e6749d 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java
@@ -14,10 +14,6 @@
import com.azure.core.implementation.util.FluxUtil;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
-import com.azure.storage.common.Utility;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.implementation.AzureFileStorageImpl;
import com.azure.storage.file.implementation.models.ShareCreateSnapshotHeaders;
@@ -880,100 +876,6 @@ public String getSnapshotId() {
return this.snapshot;
}
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param permissions The {@code ShareSasPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredentials} is null
- */
- public String generateSAS(ShareSasPermission permissions, OffsetDateTime expiryTime) {
- return this.generateSAS(null, permissions, expiryTime, null /* startTime */, /* identifier */ null /*
- version */, null /* sasProtocol */, null /* ipRange */, null /* cacheControl */, null /* contentLanguage*/,
- null /* contentEncoding */, null /* contentLanguage */, null /* contentType */);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the share this SAS references if any
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredentials} is null
- */
- public String generateSAS(String identifier) {
- return this.generateSAS(identifier, null /* permissions */, null /* expiryTime */, null /* startTime */,
- null /* version */, null /* sasProtocol */, null /* ipRange */, null /* cacheControl */, null /*
- contentLanguage*/, null /* contentEncoding */, null /* contentLanguage */, null /* contentType */);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the share this SAS references if any
- * @param permissions The {@code ShareSasPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredentials} is null
- */
- public String generateSAS(String identifier, ShareSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange) {
- return this.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange, null
- /* cacheControl */, null /* contentLanguage*/, null /* contentEncoding */, null /* contentLanguage */,
- null /* contentType */);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.file.shareAsyncClient.generateSAS#String-ShareSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String}
- *
- * For more information, see the
- * Azure Docs.
- *
- * @param identifier The {@code String} name of the access policy on the share this SAS references if any
- * @param permissions The {@code ShareSasPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param cacheControl An optional {@code String} cache-control header for the SAS.
- * @param contentDisposition An optional {@code String} content-disposition header for the SAS.
- * @param contentEncoding An optional {@code String} content-encoding header for the SAS.
- * @param contentLanguage An optional {@code String} content-language header for the SAS.
- * @param contentType An optional {@code String} content-type header for the SAS.
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredentials} is null
- */
- public String generateSAS(String identifier, ShareSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange, String cacheControl,
- String contentDisposition, String contentEncoding, String contentLanguage, String contentType) {
-
- FileServiceSasSignatureValues fileServiceSASSignatureValues = new FileServiceSasSignatureValues(version,
- sasProtocol, startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange,
- identifier, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
-
- SharedKeyCredential sharedKeyCredential =
- Utility.getSharedKeyCredential(this.azureFileStorageClient.getHttpPipeline());
-
- Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential);
-
- FileServiceSasSignatureValues values = configureServiceSASSignatureValues(fileServiceSASSignatureValues,
- sharedKeyCredential.getAccountName());
-
- FileServiceSasQueryParameters fileServiceSasQueryParameters =
- values.generateSASQueryParameters(sharedKeyCredential);
-
- return fileServiceSasQueryParameters.encode();
- }
-
/**
* Get share name from share client.
*
@@ -987,21 +889,6 @@ public String getShareName() {
return shareName;
}
- /**
- * Sets fileServiceSASSignatureValues parameters dependent on the current file type
- */
- FileServiceSasSignatureValues configureServiceSASSignatureValues(
- FileServiceSasSignatureValues fileServiceSASSignatureValues, String accountName) {
-
- // Set canonical name
- fileServiceSASSignatureValues.setCanonicalName(this.shareName, accountName);
-
- // Set resource
- fileServiceSASSignatureValues.setResource(Constants.UrlConstants.SAS_SHARE_CONSTANT);
-
- return fileServiceSASSignatureValues;
- }
-
private Response mapToShareInfoResponse(Response> response) {
String eTag = response.getHeaders().getValue("ETag");
OffsetDateTime lastModified =
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java
index 09705a2b319c..c1ce43c3600d 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java
@@ -8,8 +8,6 @@
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.models.FileHTTPHeaders;
@@ -22,7 +20,6 @@
import reactor.core.publisher.Mono;
import java.time.Duration;
-import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;
@@ -783,75 +780,6 @@ public String getSnapshotId() {
return client.getSnapshotId();
}
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param permissions The {@code ShareSasPermission} permission for the SAS
- * @return A string that represents the SAS token
- */
- public String generateSAS(OffsetDateTime expiryTime, ShareSasPermission permissions) {
- return this.client.generateSAS(permissions, expiryTime);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the share this SAS references if any
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier) {
- return this.client.generateSAS(identifier);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the share this SAS references if any
- * @param permissions The {@code ShareSasPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier, ShareSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange) {
- return this.client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.file.ShareClient.generateSAS#String-ShareSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String}
- *
- * For more information, see the
- * Azure Docs.
- *
- * @param identifier The {@code String} name of the access policy on the share this SAS references if any
- * @param permissions The {@code ShareSasPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param cacheControl An optional {@code String} cache-control header for the SAS.
- * @param contentDisposition An optional {@code String} content-disposition header for the SAS.
- * @param contentEncoding An optional {@code String} content-encoding header for the SAS.
- * @param contentLanguage An optional {@code String} content-language header for the SAS.
- * @param contentType An optional {@code String} content-type header for the SAS.
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier, ShareSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange, String cacheControl,
- String contentDisposition, String contentEncoding, String contentLanguage, String contentType) {
- return this.client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol,
- ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- }
-
/**
* Get share name from share client.
*
diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java
index 7b6ca74aad84..caf32d80748a 100644
--- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java
@@ -2,9 +2,6 @@
// Licensed under the MIT License.
package com.azure.storage.file;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.models.FileHTTPHeaders;
import com.azure.storage.file.models.FileProperties;
@@ -641,36 +638,6 @@ public void forceCloseHandlesAsync() {
// END: com.azure.storage.file.fileAsyncClient.forceCloseHandles#string
}
- /**
- * Generates a code sample for using {@link FileAsyncClient#generateSAS(String, FileSasPermission, OffsetDateTime,
- * OffsetDateTime, String, SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateSASAsync() {
- FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken();
- // BEGIN: com.azure.storage.file.fileAsyncClient.generateSAS#String-FileSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- String identifier = "identifier";
- FileSasPermission permissions = new FileSasPermission()
- .setReadPermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setWritePermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- String sas = fileAsyncClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol,
- ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- // END: com.azure.storage.file.fileAsyncClient.generateSAS#String-FileSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
/**
* Generates a code sample for using {@link FileAsyncClient#getShareSnapshotId()}
*/
diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java
index 2abd06a843d5..767c6836d4cd 100644
--- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java
@@ -4,9 +4,6 @@
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.models.FileCopyInfo;
import com.azure.storage.file.models.FileDownloadInfo;
@@ -595,36 +592,6 @@ public void forceCloseHandles() {
// END: com.azure.storage.file.fileClient.forceCloseHandles#string-duration-context
}
- /**
- * Generates a code sample for using {@link FileClient#generateSAS(String, FileSasPermission, OffsetDateTime,
- * OffsetDateTime, String, SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateSAS() {
- FileClient fileClient = createClientWithSASToken();
- // BEGIN: com.azure.storage.file.FileClient.generateSAS#String-FileSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- String identifier = "identifier";
- FileSasPermission permissions = new FileSasPermission()
- .setReadPermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setWritePermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- String sas = fileClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol,
- ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- // END: com.azure.storage.file.FileClient.generateSAS#String-FileSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
/**
* Generates a code sample for using {@link FileClient#getShareSnapshotId()}
*/
diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java
index b03788231226..d6f511c97ace 100644
--- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java
@@ -2,12 +2,6 @@
// Licensed under the MIT License.
package com.azure.storage.file;
-import com.azure.storage.common.AccountSASPermission;
-import com.azure.storage.common.AccountSASResourceType;
-import com.azure.storage.common.AccountSASService;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.models.FileServiceProperties;
import com.azure.storage.file.models.ListSharesOptions;
@@ -266,42 +260,4 @@ public void clearPropertiesAsync() {
});
// END: com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponse#fileServiceProperties.clearCORS
}
-
- /**
- * Generates a code sample for using {@link FileServiceAsyncClient#generateAccountSAS(AccountSASService,
- * AccountSASResourceType, AccountSASPermission, OffsetDateTime, OffsetDateTime, String, IpRange, SASProtocol)}
- */
- public void generateAccountSASAsync() {
- FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken();
- // BEGIN: com.azure.storage.file.FileServiceAsyncClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol
- AccountSASService service = new AccountSASService()
- .setBlob(true)
- .setFile(true)
- .setQueue(true)
- .setTable(true);
- AccountSASResourceType resourceType = new AccountSASResourceType()
- .setContainer(true)
- .setObject(true)
- .setService(true);
- AccountSASPermission permission = new AccountSASPermission()
- .setReadPermission(true)
- .setAddPermission(true)
- .setCreatePermission(true)
- .setWritePermission(true)
- .setDeletePermission(true)
- .setListPermission(true)
- .setProcessMessages(true)
- .setUpdatePermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- String sas = fileServiceAsyncClient.generateAccountSAS(service, resourceType, permission, expiryTime, startTime,
- version, ipRange, sasProtocol);
- // END: com.azure.storage.file.FileServiceAsyncClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol
- }
}
diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java
index 72294a00ae7b..77f5aa0dbd59 100644
--- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java
@@ -4,12 +4,6 @@
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
-import com.azure.storage.common.AccountSASPermission;
-import com.azure.storage.common.AccountSASResourceType;
-import com.azure.storage.common.AccountSASService;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.models.FileServiceProperties;
import com.azure.storage.file.models.ListSharesOptions;
@@ -257,44 +251,4 @@ public void clearProperties() {
System.out.printf("Setting File service properties completed with status code %d", response.getStatusCode());
// END: com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context.clearCORS
}
-
- /**
- * Generates a code sample for using {@link FileServiceClient#generateAccountSAS(AccountSASService,
- * AccountSASResourceType, AccountSASPermission, OffsetDateTime, OffsetDateTime, String, IpRange, SASProtocol)}
- */
- public void generateAccountSAS() {
- FileServiceClient fileServiceClient = createClientWithSASToken();
- // BEGIN: com.azure.storage.file.FileServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol
- AccountSASService service = new AccountSASService()
- .setBlob(true)
- .setFile(true)
- .setQueue(true)
- .setTable(true);
- AccountSASResourceType resourceType = new AccountSASResourceType()
- .setContainer(true)
- .setObject(true)
- .setService(true);
- AccountSASPermission permission = new AccountSASPermission()
- .setReadPermission(true)
- .setAddPermission(true)
- .setCreatePermission(true)
- .setWritePermission(true)
- .setDeletePermission(true)
- .setListPermission(true)
- .setProcessMessages(true)
- .setUpdatePermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- String sas = fileServiceClient.generateAccountSAS(service, resourceType, permission, expiryTime, startTime,
- version, ipRange, sasProtocol);
- // END: com.azure.storage.file.FileServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol
- }
-
-
}
diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java
index 6b17608efeb2..d74a8b5bd6c4 100644
--- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java
@@ -2,9 +2,6 @@
// Licensed under the MIT License.
package com.azure.storage.file;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.models.AccessPolicy;
import com.azure.storage.file.models.FileHTTPHeaders;
@@ -520,37 +517,6 @@ public void getSnapshotIdAsync() {
// END: com.azure.storage.file.shareAsyncClient.getSnapshotId
}
- /**
- * Generates a code sample for using {@link ShareAsyncClient#generateSAS(String, ShareSasPermission, OffsetDateTime,
- * OffsetDateTime, String, SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateSASAsync() {
- ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken();
- // BEGIN: com.azure.storage.file.shareAsyncClient.generateSAS#String-ShareSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- String identifier = "identifier";
- ShareSasPermission permissions = new ShareSasPermission()
- .setReadPermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setWritePermission(true)
- .setListPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- String sas = shareAsyncClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol,
- ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- // END: com.azure.storage.file.shareAsyncClient.generateSAS#String-ShareSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
/**
* Generates a code sample for using {@link ShareAsyncClient#getShareName()}
*/
diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java
index 7b5a659e235a..813b5591e541 100644
--- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java
@@ -4,9 +4,6 @@
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.models.AccessPolicy;
import com.azure.storage.file.models.FileHTTPHeaders;
@@ -510,37 +507,6 @@ public void getSnapshotId() {
// END: com.azure.storage.file.shareClient.getSnapshotId
}
- /**
- * Generates a code sample for using {@link ShareClient#generateSAS(String, ShareSasPermission, OffsetDateTime,
- * OffsetDateTime, String, SASProtocol, IpRange, String, String, String, String, String)}
- */
- public void generateSAS() {
- ShareClient shareClient = createClientWithSASToken();
- // BEGIN: com.azure.storage.file.ShareClient.generateSAS#String-ShareSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- String identifier = "identifier";
- ShareSasPermission permissions = new ShareSasPermission()
- .setReadPermission(true)
- .setCreatePermission(true)
- .setDeletePermission(true)
- .setWritePermission(true)
- .setListPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String cacheControl = "cache";
- String contentDisposition = "disposition";
- String contentEncoding = "encoding";
- String contentLanguage = "language";
- String contentType = "type";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- String sas = shareClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol,
- ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType);
- // END: com.azure.storage.file.ShareClient.generateSAS#String-ShareSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange-String-String-String-String-String
- }
-
/**
* Generates a code sample for using {@link ShareClient#getShareName()}
*/
diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/APISpec.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/APISpec.groovy
index 1b8d9972f75b..9f7ef550b3aa 100644
--- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/APISpec.groovy
+++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/APISpec.groovy
@@ -10,9 +10,8 @@ import com.azure.core.http.policy.HttpLogDetailLevel
import com.azure.core.test.InterceptorManager
import com.azure.core.test.TestMode
import com.azure.core.test.utils.TestResourceNamer
-import com.azure.core.util.Configuration;
+import com.azure.core.util.Configuration
import com.azure.core.util.logging.ClientLogger
-
import com.azure.storage.file.FileClientBuilder
import com.azure.storage.file.FileServiceAsyncClient
import com.azure.storage.file.FileServiceClient
@@ -41,7 +40,7 @@ class APISpec extends Specification {
// Test name for test method name.
def methodName
def testMode = getTestMode()
- def connectionString
+ String connectionString
// If debugging is enabled, recordings cannot run as there can only be one proxy at a time.
static boolean enableDebugging = false
diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAPITests.groovy
index d32dcbbc78d6..5ab6d3ea6d95 100644
--- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAPITests.groovy
+++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAPITests.groovy
@@ -393,7 +393,14 @@ class FileAPITests extends APISpec {
def destinationOffset = 0
primaryFileClient.upload(ByteBuffer.wrap(data.getBytes()), data.length())
- def sasToken = primaryFileClient.generateSAS(getUTCNow().plusDays(1), new FileSasPermission().setReadPermission(true))
+ def credential = SharedKeyCredential.fromConnectionString(connectionString)
+ def sasToken = new FileServiceSasSignatureValues()
+ .setExpiryTime(getUTCNow().plusDays(1))
+ .setPermissions(new FileSasPermission().setReadPermission(true).toString())
+ .setCanonicalName(primaryFileClient.getShareName(), primaryFileClient.getFilePath(), credential.getAccountName())
+ .setResource(Constants.UrlConstants.SAS_FILE_CONSTANT)
+ .generateSASQueryParameters(credential)
+ .encode()
when:
FileClient client = fileBuilderHelper(interceptorManager, shareName, "destination")
diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAsyncAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAsyncAPITests.groovy
index 4201c3e21914..896539f3858b 100644
--- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAsyncAPITests.groovy
+++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileAsyncAPITests.groovy
@@ -5,6 +5,7 @@ package com.azure.storage.file
import com.azure.core.exception.HttpResponseException
import com.azure.core.exception.UnexpectedLengthException
+import com.azure.storage.common.Constants
import com.azure.storage.common.credentials.SharedKeyCredential
import com.azure.storage.file.models.FileHTTPHeaders
import com.azure.storage.file.models.FileRange
@@ -385,7 +386,14 @@ class FileAsyncAPITests extends APISpec {
def destinationOffset = 0
primaryFileAsyncClient.upload(Flux.just(ByteBuffer.wrap(data.getBytes())), data.length()).block()
- def sasToken = primaryFileAsyncClient.generateSAS(new FileSasPermission().setReadPermission(true), getUTCNow().plusDays(1))
+ def credential = SharedKeyCredential.fromConnectionString(connectionString)
+ def sasToken = new FileServiceSasSignatureValues()
+ .setExpiryTime(getUTCNow().plusDays(1))
+ .setPermissions(new FileSasPermission().setReadPermission(true).toString())
+ .setCanonicalName(primaryFileAsyncClient.getShareName(), primaryFileAsyncClient.getFilePath(), credential.getAccountName())
+ .setResource(Constants.UrlConstants.SAS_FILE_CONSTANT)
+ .generateSASQueryParameters(credential)
+ .encode()
when:
FileAsyncClient client = fileBuilderHelper(interceptorManager, shareName, "destination")
diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileSASTests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileSASTests.groovy
index e1237bf73d92..131c41664c06 100644
--- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileSASTests.groovy
+++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileSASTests.groovy
@@ -3,10 +3,11 @@ package com.azure.storage.file
import com.azure.storage.common.AccountSASPermission
import com.azure.storage.common.AccountSASResourceType
import com.azure.storage.common.AccountSASService
+import com.azure.storage.common.AccountSASSignatureValues
import com.azure.storage.common.Constants
import com.azure.storage.common.IpRange
import com.azure.storage.common.SASProtocol
-
+import com.azure.storage.common.credentials.SharedKeyCredential
import com.azure.storage.file.models.AccessPolicy
import com.azure.storage.file.models.SignedIdentifier
import com.azure.storage.file.models.StorageException
@@ -136,15 +137,17 @@ class FileSASTests extends APISpec {
def "serviceSASSignatureValues canonicalizedResource"() {
setup:
- def fileName = primaryFileClient.getFilePath()
+ def filePath = primaryFileClient.getFilePath()
def shareName = primaryFileClient.getShareName()
def accountName = "account"
when:
- def serviceSASSignatureValues = primaryFileClient.fileAsyncClient.configureServiceSASSignatureValues(new FileServiceSasSignatureValues(), accountName)
+ def serviceSASSignatureValues = new FileServiceSasSignatureValues()
+ .setCanonicalName(shareName, filePath, accountName)
+ .setResource(Constants.UrlConstants.SAS_FILE_CONSTANT)
then:
- serviceSASSignatureValues.getCanonicalName() == "/file/" + accountName + "/" + shareName + "/" + fileName
+ serviceSASSignatureValues.getCanonicalName() == "/file/" + accountName + "/" + shareName + "/" + filePath
}
def "FileSAS network test download upload"() {
@@ -171,7 +174,22 @@ class FileSASTests extends APISpec {
def contentType = "type"
when:
- def sas = primaryFileClient.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType)
+ def credential = SharedKeyCredential.fromConnectionString(connectionString)
+ def sas = new FileServiceSasSignatureValues()
+ .setPermissions(permissions.toString())
+ .setExpiryTime(expiryTime)
+ .setStartTime(startTime)
+ .setProtocol(sasProtocol)
+ .setIpRange(ipRange)
+ .setCacheControl(cacheControl)
+ .setContentDisposition(contentDisposition)
+ .setContentEncoding(contentEncoding)
+ .setContentLanguage(contentLanguage)
+ .setContentType(contentType)
+ .setCanonicalName(primaryFileClient.getShareName(), primaryFileClient.getFilePath(), credential.getAccountName())
+ .setResource(Constants.UrlConstants.SAS_FILE_CONSTANT)
+ .generateSASQueryParameters(credential)
+ .encode()
then:
sas != null
@@ -218,7 +236,22 @@ class FileSASTests extends APISpec {
def contentType = "type"
when:
- def sas = primaryFileClient.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType)
+ def credential = SharedKeyCredential.fromConnectionString(connectionString)
+ def sas = new FileServiceSasSignatureValues()
+ .setPermissions(permissions.toString())
+ .setExpiryTime(expiryTime)
+ .setStartTime(startTime)
+ .setProtocol(sasProtocol)
+ .setIpRange(ipRange)
+ .setCacheControl(cacheControl)
+ .setContentDisposition(contentDisposition)
+ .setContentEncoding(contentEncoding)
+ .setContentLanguage(contentLanguage)
+ .setContentType(contentType)
+ .setCanonicalName(primaryFileClient.getShareName(), primaryFileClient.getFilePath(), credential.getAccountName())
+ .setResource(Constants.UrlConstants.SAS_FILE_CONSTANT)
+ .generateSASQueryParameters(credential)
+ .encode()
def client = fileBuilderHelper(interceptorManager, shareName, filePath)
.endpoint(primaryFileClient.getFileUrl())
@@ -257,7 +290,13 @@ class FileSASTests extends APISpec {
OffsetDateTime expiryTime = getUTCNow().plusDays(1)
when:
- String sasWithId = primaryShareClient.generateSAS(identifier.getId())
+ def credential = SharedKeyCredential.fromConnectionString(connectionString)
+ def sasWithId = new FileServiceSasSignatureValues()
+ .setIdentifier(identifier.getId())
+ .setCanonicalName(primaryShareClient.getShareName(), credential.getAccountName())
+ .setResource(Constants.UrlConstants.SAS_SHARE_CONSTANT)
+ .generateSASQueryParameters(credential)
+ .encode()
ShareClient client1 = shareBuilderHelper(interceptorManager, primaryShareClient.getShareName())
.endpoint(primaryShareClient.getShareUrl())
@@ -267,7 +306,13 @@ class FileSASTests extends APISpec {
client1.createDirectory("dir")
client1.deleteDirectory("dir")
- String sasWithPermissions = primaryShareClient.generateSAS(expiryTime, permissions)
+ def sasWithPermissions = new FileServiceSasSignatureValues()
+ .setPermissions(permissions.toString())
+ .setExpiryTime(expiryTime)
+ .setCanonicalName(primaryShareClient.getShareName(), credential.getAccountName())
+ .setResource(Constants.UrlConstants.SAS_SHARE_CONSTANT)
+ .generateSASQueryParameters(credential)
+ .encode()
def client2 = shareBuilderHelper(interceptorManager, primaryShareClient.getShareName())
.endpoint(primaryFileClient.getFileUrl())
@@ -296,7 +341,8 @@ class FileSASTests extends APISpec {
def expiryTime = getUTCNow().plusDays(1)
when:
- def sas = primaryFileServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null)
+ def credential = SharedKeyCredential.fromConnectionString(connectionString)
+ def sas = AccountSASSignatureValues.generateAccountSAS(credential, service, resourceType, permissions, expiryTime, null, null, null, null)
then:
sas != null
diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java
index ae2a82a1799b..2dddbacc2b52 100644
--- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java
+++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java
@@ -11,8 +11,6 @@
import com.azure.core.implementation.http.PagedResponseBase;
import com.azure.core.implementation.util.FluxUtil;
import com.azure.core.util.Context;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.queue.implementation.AzureQueueStorageImpl;
@@ -31,7 +29,6 @@
import reactor.core.publisher.Mono;
import java.time.Duration;
-import java.time.OffsetDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Map;
@@ -744,73 +741,6 @@ Mono> deleteMessageWithResponse(String messageId, String popRecei
.map(response -> new SimpleResponse<>(response, null));
}
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param permissions The {@code QueueSasPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredential} is null
- */
- public String generateSAS(QueueSasPermission permissions, OffsetDateTime expiryTime) {
- return this.generateSAS(null, permissions, expiryTime, null /* startTime */, /* identifier */ null /*
- version */, null /* sasProtocol */, null /* ipRange */);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the queue this SAS references if any
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredential} is null
- */
- public String generateSAS(String identifier) {
- return this.generateSAS(identifier, null /* permissions */, null /* expiryTime */, null /* startTime */,
- null /* version */, null /* sasProtocol */, null /* ipRange */);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.queue.queueAsyncClient.generateSAS#String-QueueSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange}
- *
- * For more information, see the
- * Azure Docs.
- *
- * @param identifier The {@code String} name of the access policy on the queue this SAS references if any
- * @param permissions The {@code QueueSasPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredential} is null
- */
- public String generateSAS(String identifier, QueueSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange) {
-
- QueueServiceSasSignatureValues queueServiceSASSignatureValues = new QueueServiceSasSignatureValues(version,
- sasProtocol, startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange,
- identifier);
-
- SharedKeyCredential sharedKeyCredential =
- Utility.getSharedKeyCredential(this.client.getHttpPipeline());
-
- Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential);
-
- // Set canonical name
- QueueServiceSasSignatureValues values = queueServiceSASSignatureValues
- .setCanonicalName(this.queueName, sharedKeyCredential.getAccountName());
-
- QueueServiceSasQueryParameters queueServiceSasQueryParameters = values
- .generateSASQueryParameters(sharedKeyCredential);
-
- return queueServiceSasQueryParameters.encode();
- }
-
/**
* Get the queue name of the client.
*
diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java
index 3c6a2c1743ef..445ac4e52cc0 100644
--- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java
+++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java
@@ -6,8 +6,6 @@
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.queue.models.DequeuedMessage;
@@ -20,7 +18,6 @@
import reactor.core.publisher.Mono;
import java.time.Duration;
-import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;
@@ -655,52 +652,6 @@ public Response deleteMessageWithResponse(String messageId, String popRece
return Utility.blockWithOptionalTimeout(response, timeout);
}
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param permissions The {@code QueueSasPermission} permission for the SAS
- * @return A string that represents the SAS token
- */
- public String generateSAS(OffsetDateTime expiryTime, QueueSasPermission permissions) {
- return this.client.generateSAS(permissions, expiryTime);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * @param identifier The {@code String} name of the access policy on the queue this SAS references if any
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier) {
- return this.client.generateSAS(identifier);
- }
-
- /**
- * Generates a SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.queue.queueClient.generateSAS#String-QueueSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange}
- *
- * For more information, see the
- * Azure Docs.
- *
- * @param identifier The {@code String} name of the access policy on the queue this SAS references if any
- * @param permissions The {@code QueueSasPermission} permission for the SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS
- * @param startTime An optional {@code OffsetDateTime} start time for the SAS
- * @param version An optional {@code String} version for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @return A string that represents the SAS token
- */
- public String generateSAS(String identifier, QueueSasPermission permissions, OffsetDateTime expiryTime,
- OffsetDateTime startTime, String version, SASProtocol sasProtocol, IpRange ipRange) {
- return this.client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol,
- ipRange);
- }
-
/**
* Get the queue name of the client.
*
diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java
index fa5e57fa2fe1..055ef8b15f6f 100644
--- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java
+++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java
@@ -11,17 +11,11 @@
import com.azure.core.implementation.util.FluxUtil;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
-import com.azure.storage.common.AccountSASPermission;
-import com.azure.storage.common.AccountSASResourceType;
-import com.azure.storage.common.AccountSASService;
-import com.azure.storage.common.AccountSASSignatureValues;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.queue.implementation.AzureQueueStorageImpl;
-import com.azure.storage.queue.models.CorsRule;
import com.azure.storage.queue.implementation.models.ListQueuesIncludeType;
+import com.azure.storage.queue.models.CorsRule;
import com.azure.storage.queue.models.QueueItem;
import com.azure.storage.queue.models.QueuesSegmentOptions;
import com.azure.storage.queue.models.StorageException;
@@ -30,7 +24,6 @@
import reactor.core.publisher.Mono;
import java.time.Duration;
-import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -423,53 +416,4 @@ Mono> getStatisticsWithResponse(Context context) {
return postProcessResponse(client.services().getStatisticsWithRestResponseAsync(context))
.map(response -> new SimpleResponse<>(response, response.getValue()));
}
-
- /**
- * Generates an account SAS token with the specified parameters
- *
- * @param accountSASService The {@code AccountSASService} services for the account SAS
- * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS
- * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredential} is null
- */
- public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType,
- AccountSASPermission accountSASPermission, OffsetDateTime expiryTime) {
- return this.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime,
- null /* startTime */, null /* version */, null /* ipRange */, null /* sasProtocol */);
- }
-
- /**
- * Generates an account SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol}
- *
- * For more information, see the
- * Azure Docs.
- *
- * @param accountSASService The {@code AccountSASService} services for the account SAS
- * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS
- * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS
- * @param startTime The {@code OffsetDateTime} start time for the account SAS
- * @param version The {@code String} version for the account SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @return A string that represents the SAS token
- * @throws NullPointerException If {@code sharedKeyCredential} is null
- */
- public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType,
- AccountSASPermission accountSASPermission, OffsetDateTime expiryTime, OffsetDateTime startTime,
- String version, IpRange ipRange, SASProtocol sasProtocol) {
-
- SharedKeyCredential sharedKeyCredential = Utility.getSharedKeyCredential(this.client.getHttpPipeline());
- Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential);
-
- return AccountSASSignatureValues.generateAccountSAS(sharedKeyCredential, accountSASService,
- accountSASResourceType, accountSASPermission, expiryTime, startTime, version, ipRange, sasProtocol);
-
- }
}
diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java
index 4b9aea6e6e9c..fb18329856e1 100644
--- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java
+++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java
@@ -7,11 +7,6 @@
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
-import com.azure.storage.common.AccountSASPermission;
-import com.azure.storage.common.AccountSASResourceType;
-import com.azure.storage.common.AccountSASService;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.Utility;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.queue.models.CorsRule;
@@ -23,7 +18,6 @@
import reactor.core.publisher.Mono;
import java.time.Duration;
-import java.time.OffsetDateTime;
import java.util.Map;
/**
@@ -390,47 +384,4 @@ public Response getStatisticsWithResponse(Duration timeout,
Mono> response = client.getStatisticsWithResponse(context);
return Utility.blockWithOptionalTimeout(response, timeout);
}
-
- /**
- * Generates an account SAS token with the specified parameters
- *
- * @param accountSASService The {@code AccountSASService} services for the account SAS
- * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS
- * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS
- * @return A string that represents the SAS token
- */
- public String generateAccountSAS(AccountSASService accountSASService,
- AccountSASResourceType accountSASResourceType, AccountSASPermission accountSASPermission,
- OffsetDateTime expiryTime) {
- return this.client.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission,
- expiryTime);
- }
-
- /**
- * Generates an account SAS token with the specified parameters
- *
- * Code Samples
- *
- * {@codesnippet com.azure.storage.queue.queueServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol}
- *
- * For more information, see the
- * Azure Docs.
- *
- * @param accountSASService The {@code AccountSASService} services for the account SAS
- * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS
- * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS
- * @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS
- * @param startTime The {@code OffsetDateTime} start time for the account SAS
- * @param version The {@code String} version for the account SAS
- * @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
- * @return A string that represents the SAS token
- */
- public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType,
- AccountSASPermission accountSASPermission, OffsetDateTime expiryTime, OffsetDateTime startTime,
- String version, IpRange ipRange, SASProtocol sasProtocol) {
- return this.client.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission,
- expiryTime, startTime, version, ipRange, sasProtocol);
- }
}
diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSasSignatureValues.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSasSignatureValues.java
index b4e93307c9b2..9d6d16a4a3c8 100644
--- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSasSignatureValues.java
+++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSasSignatureValues.java
@@ -28,7 +28,7 @@
* here
* for additional samples.
*/
-final class QueueServiceSasSignatureValues {
+public final class QueueServiceSasSignatureValues {
private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueAsyncJavaDocCodeSamples.java
index f3aae43bd054..cf6b3e4479e0 100644
--- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueAsyncJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueAsyncJavaDocCodeSamples.java
@@ -2,9 +2,6 @@
// Licensed under the MIT License.
package com.azure.storage.queue;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.queue.models.AccessPolicy;
import com.azure.storage.queue.models.QueueProperties;
@@ -483,31 +480,6 @@ public void clearMessagesAsync() {
// END: com.azure.storage.queue.queueAsyncClient.clearMessages
}
- /**
- * Code snippet for {@link QueueAsyncClient#generateSAS(String, QueueSasPermission, OffsetDateTime, OffsetDateTime,
- * String, SASProtocol, IpRange)}
- */
- public void generateSASCodeSnippets() {
- // BEGIN: com.azure.storage.queue.queueAsyncClient.generateSAS#String-QueueSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange
- QueueSasPermission permissions = new QueueSasPermission()
- .setReadPermission(true)
- .setAddPermission(true)
- .setUpdatePermission(true)
- .setProcessPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String identifier = "";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- // Note either "identifier", or "expiryTime and permissions" are required to be set
- String sas = client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange);
- // END: com.azure.storage.queue.queueAsyncClient.generateSAS#String-QueueSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange
- }
-
/**
* Generates a code sample for using {@link QueueAsyncClient#getQueueName()}
*/
diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueJavaDocCodeSamples.java
index bb32debcb231..f69c08be8d64 100644
--- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueJavaDocCodeSamples.java
@@ -4,9 +4,6 @@
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.queue.models.AccessPolicy;
import com.azure.storage.queue.models.DequeuedMessage;
@@ -442,31 +439,6 @@ public void clearMessagesWithResponse() {
// END: com.azure.storage.queue.queueClient.clearMessagesWithResponse#duration-context
}
- /**
- * Code snippet for {@link QueueClient#generateSAS(String, QueueSasPermission, OffsetDateTime, OffsetDateTime,
- * String, SASProtocol, IpRange)}
- */
- public void generateSASCodeSnippets() {
- // BEGIN: com.azure.storage.queue.queueClient.generateSAS#String-QueueSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange
- QueueSasPermission permissions = new QueueSasPermission()
- .setReadPermission(true)
- .setAddPermission(true)
- .setUpdatePermission(true)
- .setProcessPermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String identifier = "";
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- // Note either "identifier", or "expiryTime and permissions" are required to be set
- String sas = client.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange);
- // END: com.azure.storage.queue.queueClient.generateSAS#String-QueueSasPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IpRange
- }
-
/**
* Generates a code sample for using {@link QueueClient#getQueueName()}
*/
diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceAsyncJavaDocCodeSamples.java
index b6bbb02aebbc..36998f48e588 100644
--- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceAsyncJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceAsyncJavaDocCodeSamples.java
@@ -2,18 +2,11 @@
// Licensed under the MIT License.
package com.azure.storage.queue;
-import com.azure.storage.common.AccountSASPermission;
-import com.azure.storage.common.AccountSASResourceType;
-import com.azure.storage.common.AccountSASService;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.queue.models.QueuesSegmentOptions;
import com.azure.storage.queue.models.StorageServiceProperties;
import com.azure.storage.queue.models.StorageServiceStats;
-import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.Map;
@@ -267,41 +260,4 @@ public void getStatisticsWithResponse() {
});
// END: com.azure.storage.queue.queueServiceAsyncClient.getStatisticsWithResponse
}
-
- /**
- * Generates a code sample for using {@link QueueServiceAsyncClient#generateAccountSAS(AccountSASService,
- * AccountSASResourceType, AccountSASPermission, OffsetDateTime, OffsetDateTime, String, IpRange, SASProtocol)}
- */
- public void generateAccountSAS() {
- // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol
- AccountSASService service = new AccountSASService()
- .setBlob(true)
- .setFile(true)
- .setQueue(true)
- .setTable(true);
- AccountSASResourceType resourceType = new AccountSASResourceType()
- .setContainer(true)
- .setObject(true)
- .setService(true);
- AccountSASPermission permission = new AccountSASPermission()
- .setReadPermission(true)
- .setAddPermission(true)
- .setCreatePermission(true)
- .setWritePermission(true)
- .setDeletePermission(true)
- .setListPermission(true)
- .setProcessMessages(true)
- .setUpdatePermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- String sas = client.generateAccountSAS(service, resourceType, permission, expiryTime, startTime, version,
- ipRange, sasProtocol);
- // END: com.azure.storage.queue.queueServiceAsyncClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol
- }
}
diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceJavaDocCodeSamples.java
index b9a7838fd4a9..2a91874c6bd9 100644
--- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceJavaDocCodeSamples.java
@@ -4,19 +4,12 @@
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
-import com.azure.storage.common.AccountSASPermission;
-import com.azure.storage.common.AccountSASResourceType;
-import com.azure.storage.common.AccountSASService;
-import com.azure.storage.common.Constants;
-import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.queue.models.QueuesSegmentOptions;
import com.azure.storage.queue.models.StorageServiceProperties;
import com.azure.storage.queue.models.StorageServiceStats;
import java.time.Duration;
-import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.Map;
@@ -257,41 +250,4 @@ public void getStatisticsWithResponse() {
stats.getGeoReplication().getStatus(), stats.getGeoReplication().getLastSyncTime());
// END: com.azure.storage.queue.queueServiceClient.getStatisticsWithResponse#duration-context
}
-
- /**
- * Generates a code sample for using {@link QueueServiceClient#generateAccountSAS(AccountSASService,
- * AccountSASResourceType, AccountSASPermission, OffsetDateTime, OffsetDateTime, String, IpRange, SASProtocol)}
- */
- public void generateAccountSAS() {
- // BEGIN: com.azure.storage.queue.queueServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol
- AccountSASService service = new AccountSASService()
- .setBlob(true)
- .setFile(true)
- .setQueue(true)
- .setTable(true);
- AccountSASResourceType resourceType = new AccountSASResourceType()
- .setContainer(true)
- .setObject(true)
- .setService(true);
- AccountSASPermission permission = new AccountSASPermission()
- .setReadPermission(true)
- .setAddPermission(true)
- .setCreatePermission(true)
- .setWritePermission(true)
- .setDeletePermission(true)
- .setListPermission(true)
- .setProcessMessages(true)
- .setUpdatePermission(true);
- OffsetDateTime startTime = OffsetDateTime.now().minusDays(1);
- OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);
- IpRange ipRange = new IpRange()
- .setIpMin("0.0.0.0")
- .setIpMax("255.255.255.255");
- SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP;
- String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
-
- String sas = client.generateAccountSAS(service, resourceType, permission, expiryTime, startTime, version,
- ipRange, sasProtocol);
- // END: com.azure.storage.queue.queueServiceClient.generateAccountSAS#AccountSASService-AccountSASResourceType-AccountSASPermission-OffsetDateTime-OffsetDateTime-String-IpRange-SASProtocol
- }
}
diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/APISpec.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/APISpec.groovy
index d5dbd5bf8502..9e66ea59896c 100644
--- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/APISpec.groovy
+++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/APISpec.groovy
@@ -4,25 +4,23 @@
package com.azure.storage.queue
import com.azure.core.http.HttpClient
-import com.azure.core.http.ProxyOptions
import com.azure.core.test.InterceptorManager
import com.azure.core.test.TestMode
import com.azure.core.test.utils.TestResourceNamer
-import com.azure.core.util.Context
import com.azure.core.util.Configuration
+import com.azure.core.util.Context
import com.azure.core.util.logging.ClientLogger
import com.azure.storage.queue.models.QueuesSegmentOptions
import spock.lang.Specification
import java.time.Duration
import java.time.OffsetDateTime
-import java.util.function.Supplier
class APISpec extends Specification {
// Field common used for all APIs.
def logger = new ClientLogger(APISpec.class)
def AZURE_TEST_MODE = "AZURE_TEST_MODE"
- def interceptorManager
+ InterceptorManager interceptorManager
TestResourceNamer testResourceName
// Clients for API tests
@@ -31,9 +29,9 @@ class APISpec extends Specification {
// Test name for test method name.
- def methodName
+ String methodName
def testMode = getTestMode()
- def connectionString
+ String connectionString
// If debugging is enabled, recordings cannot run as there can only be one proxy at a time.
static boolean enableDebugging = false
@@ -141,15 +139,6 @@ class APISpec extends Specification {
}
static HttpClient getHttpClient() {
- if (enableDebugging) {
- return HttpClient.createDefault().setProxy(new Supplier() {
- @Override
- ProxyOptions get() {
- return new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888))
- }
- })
- } else {
- return HttpClient.createDefault()
- }
+ return HttpClient.createDefault()
}
}
diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueSASTests.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueSASTests.groovy
index b5b82d6d3f73..3a63224a208a 100644
--- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueSASTests.groovy
+++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueSASTests.groovy
@@ -3,9 +3,10 @@ package com.azure.storage.queue
import com.azure.storage.common.AccountSASPermission
import com.azure.storage.common.AccountSASResourceType
import com.azure.storage.common.AccountSASService
+import com.azure.storage.common.AccountSASSignatureValues
import com.azure.storage.common.IpRange
import com.azure.storage.common.SASProtocol
-
+import com.azure.storage.common.credentials.SharedKeyCredential
import com.azure.storage.queue.models.AccessPolicy
import com.azure.storage.queue.models.EnqueuedMessage
import com.azure.storage.queue.models.SignedIdentifier
@@ -80,7 +81,7 @@ class QueueSASTests extends APISpec {
def "queueServiceSASSignatureValues canonicalizedResource"() {
setup:
- def queueName = queueClient.client.queueName
+ def queueName = queueClient.getQueueName()
def accountName = "account"
when:
@@ -108,7 +109,16 @@ class QueueSASTests extends APISpec {
def sasProtocol = SASProtocol.HTTPS_HTTP
when:
- def sasPermissions = queueClient.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange)
+ def credential = SharedKeyCredential.fromConnectionString(connectionString)
+ def sasPermissions = new QueueServiceSasSignatureValues()
+ .setPermissions(permissions.toString())
+ .setExpiryTime(expiryTime)
+ .setStartTime(startTime)
+ .setProtocol(sasProtocol)
+ .setIpRange(ipRange)
+ .setCanonicalName(queueClient.getQueueName(), credential.getAccountName())
+ .generateSASQueryParameters(credential)
+ .encode()
def clientPermissions = queueBuilderHelper(interceptorManager)
.endpoint(queueClient.getQueueUrl())
@@ -149,7 +159,16 @@ class QueueSASTests extends APISpec {
def sasProtocol = SASProtocol.HTTPS_HTTP
when:
- def sasPermissions = queueClient.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange)
+ def credential = SharedKeyCredential.fromConnectionString(connectionString)
+ def sasPermissions = new QueueServiceSasSignatureValues()
+ .setPermissions(permissions.toString())
+ .setExpiryTime(expiryTime)
+ .setStartTime(startTime)
+ .setProtocol(sasProtocol)
+ .setIpRange(ipRange)
+ .setCanonicalName(queueClient.getQueueName(), credential.getAccountName())
+ .generateSASQueryParameters(credential)
+ .encode()
def clientPermissions = queueBuilderHelper(interceptorManager)
.endpoint(queueClient.getQueueUrl())
@@ -192,7 +211,12 @@ class QueueSASTests extends APISpec {
queueClient.setAccessPolicy(Arrays.asList(identifier))
when:
- def sasIdentifier = queueClient.generateSAS(identifier.getId())
+ def credential = SharedKeyCredential.fromConnectionString(connectionString)
+ def sasIdentifier = new QueueServiceSasSignatureValues()
+ .setIdentifier(identifier.getId())
+ .setCanonicalName(queueClient.getQueueName(), credential.getAccountName())
+ .generateSASQueryParameters(credential)
+ .encode()
def clientBuilder = queueBuilderHelper(interceptorManager)
def clientIdentifier = clientBuilder
@@ -224,7 +248,8 @@ class QueueSASTests extends APISpec {
def expiryTime = getUTCNow().plusDays(1)
when:
- def sas = primaryQueueServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null)
+ def credential = SharedKeyCredential.fromConnectionString(connectionString)
+ def sas = AccountSASSignatureValues.generateAccountSAS(credential, service, resourceType, permissions, expiryTime, null, null, null, null)
def scBuilder = queueServiceBuilderHelper(interceptorManager)
scBuilder.endpoint(primaryQueueServiceClient.getQueueServiceUrl())
@@ -255,7 +280,8 @@ class QueueSASTests extends APISpec {
def expiryTime = getUTCNow().plusDays(1)
when:
- def sas = primaryQueueServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null)
+ def credential = SharedKeyCredential.fromConnectionString(connectionString)
+ def sas = AccountSASSignatureValues.generateAccountSAS(credential, service, resourceType, permissions, expiryTime, null, null, null, null)
def scBuilder = queueServiceBuilderHelper(interceptorManager)
scBuilder.endpoint(primaryQueueServiceClient.getQueueServiceUrl())
From 5cc9153366e836b32ec6ee2eeedd9580c04565e9 Mon Sep 17 00:00:00 2001
From: Connie Yau
Date: Fri, 4 Oct 2019 12:11:26 -0700
Subject: [PATCH 12/18] azure-core JavaDocs and code snippet clean-up (#5653)
* Updating comments in package-info.java.
* Update documentation in Tracer and TracerProxy.
* Add doc updates to Poller.
* Making code snippets more reactor-ish.
* Fix naming.
* Fix typos.
* Move ClientLogger java doc samples to correct location.
* Update documentation in ClientLogger.
* Fix codesnippet references.
* Update package-info.java
* Update parameter docs.
---
.../azure/core/cryptography/package-info.java | 2 +-
.../azure/core/exception/package-info.java | 2 +-
.../com/azure/core/http/package-info.java | 2 +-
.../azure/core/http/policy/package-info.java | 2 +-
.../azure/core/util/logging/ClientLogger.java | 70 +++---
.../azure/core/util/logging/package-info.java | 2 +-
.../com/azure/core/util/package-info.java | 2 +-
.../com/azure/core/util/polling/Poller.java | 118 +++++------
.../azure/core/util/polling/package-info.java | 2 +-
.../com/azure/core/util/tracing/Tracer.java | 23 +-
.../azure/core/util/tracing/TracerProxy.java | 26 ++-
.../ClientLoggerJavaDocCodeSnippets.java | 22 +-
.../polling/PollerJavaDocCodeSnippets.java | 199 ++++++------------
13 files changed, 203 insertions(+), 269 deletions(-)
rename sdk/core/azure-core/src/samples/java/com/azure/core/{implementation/util => util/logging}/ClientLoggerJavaDocCodeSnippets.java (64%)
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/cryptography/package-info.java b/sdk/core/azure-core/src/main/java/com/azure/core/cryptography/package-info.java
index 5e39ad45fb6d..5434c53876d9 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/cryptography/package-info.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/cryptography/package-info.java
@@ -2,6 +2,6 @@
// Licensed under the MIT License.
/**
- * Package containing core cryptography interfaces
+ * Package containing core cryptography interfaces.
*/
package com.azure.core.cryptography;
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/exception/package-info.java b/sdk/core/azure-core/src/main/java/com/azure/core/exception/package-info.java
index 8bd839a535ff..82842d066095 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/exception/package-info.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/exception/package-info.java
@@ -2,6 +2,6 @@
// Licensed under the MIT License.
/**
- * Package containing core exception classes
+ * Package containing core exception classes.
*/
package com.azure.core.exception;
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/package-info.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/package-info.java
index 37a44935af1c..9a231a4ea7a7 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/http/package-info.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/package-info.java
@@ -2,6 +2,6 @@
// Licensed under the MIT License.
/**
- * Package containing the HTTP abstractions between the AnnotationParser, RestProxy and HTTP client.
+ * Package containing HTTP abstractions between the AnnotationParser, RestProxy, and HTTP client.
*/
package com.azure.core.http;
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/package-info.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/package-info.java
index 5d138f009c81..3440337a13d9 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/package-info.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/package-info.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
/**
- * Package containing HttpPipelinePolicy interface and it's implementations.
+ * Package containing HttpPipelinePolicy interface and its implementations.
*/
package com.azure.core.http.policy;
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java
index f735b3fef2a2..0fe19a86758f 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java
@@ -11,15 +11,15 @@
import java.util.Objects;
/**
- * This is a fluent logger helper class that wraps a plug-able {@link Logger}.
+ * This is a fluent logger helper class that wraps a pluggable {@link Logger}.
*
- * This logger logs formattable messages that use {@code {}} as the placeholder. When a throwable is the last
- * argument of the format varargs and the logger is enabled for {@link ClientLogger#verbose(String, Object...) verbose}
- * logging the stack trace for the throwable will be included in the log message.
+ * This logger logs formattable messages that use {@code {}} as the placeholder. When a {@link Throwable throwable}
+ * is the last argument of the format varargs and the logger is enabled for
+ * {@link ClientLogger#verbose(String, Object...) verbose}, the stack trace for the throwable is logged.
*
* A minimum logging level threshold is determined by the
- * {@link Configuration#PROPERTY_AZURE_LOG_LEVEL AZURE_LOG_LEVEL} environment configuration, by default logging is
- * disabled.
+ * {@link Configuration#PROPERTY_AZURE_LOG_LEVEL AZURE_LOG_LEVEL} environment configuration. By default logging is
+ * disabled.
*
* Log level hierarchy
*
@@ -78,60 +78,64 @@ public ClientLogger(String className) {
}
/**
- * Logs a formattable message that uses {@code {}} as the placeholder at {@code verbose} log level
+ * Logs a formattable message that uses {@code {}} as the placeholder at {@code verbose} log level.
*
- * Code Samples
+ * Code samples
*
- * Logging a message at verbose log level
- * {@codesnippet com.azure.core.implementation.util.clientlogger.verbose}
+ * Logging a message at verbose log level.
+ * {@codesnippet com.azure.core.util.logging.clientlogger.verbose}
*
- * @param format The formattable message to log
- * @param args Arguments for the message, if an exception is being logged last argument is the throwable.
+ * @param format The formattable message to log.
+ * @param args Arguments for the message. If an exception is being logged, the last argument should be the
+ * {@link Throwable}.
*/
public void verbose(String format, Object... args) {
log(VERBOSE_LEVEL, format, args);
}
/**
- * Logs a formattable message that uses {@code {}} as the placeholder at {@code informational} log level
+ * Logs a formattable message that uses {@code {}} as the placeholder at {@code informational} log level.
*
- *
Code Samples
+ * Code samples
*
- * Logging a message at informational log level
- * {@codesnippet com.azure.core.implementation.util.clientlogger.info}
+ * Logging a message at informational log level.
+ * {@codesnippet com.azure.core.util.logging.clientlogger.info}
*
* @param format The formattable message to log
- * @param args Arguments for the message, if an exception is being logged last argument is the throwable.
+ * @param args Arguments for the message. If an exception is being logged, the last argument should be the
+ * {@link Throwable}.
*/
public void info(String format, Object... args) {
log(INFORMATIONAL_LEVEL, format, args);
}
/**
- * Logs a formattable message that uses {@code {}} as the placeholder at {@code warning} log level
+ * Logs a formattable message that uses {@code {}} as the placeholder at {@code warning} log level.
*
- *
Code Samples
+ * Code samples
*
- * Logging a message at warning log level
- * {@codesnippet com.azure.core.implementation.util.clientlogger.warning}
+ * Logging a message at warning log level.
+ * {@codesnippet com.azure.core.util.logging.clientlogger.warning}
*
- * @param format The formattable message to log
- * @param args Arguments for the message, if an exception is being logged last argument is the throwable.
+ * @param format The formattable message to log.
+ * @param args Arguments for the message. If an exception is being logged, the last argument should be the
+ * {@link Throwable}.
*/
public void warning(String format, Object... args) {
log(WARNING_LEVEL, format, args);
}
/**
- * Logs a formattable message that uses {@code {}} as the placeholder at {@code error} log level
+ * Logs a formattable message that uses {@code {}} as the placeholder at {@code error} log level.
*
- *
Code Samples
+ * Code samples
*
- * Logging an error with stack trace
- * {@codesnippet com.azure.core.implementation.util.clientlogger.error}
+ * Logging an error with stack trace.
+ * {@codesnippet com.azure.core.util.logging.clientlogger.error}
*
- * @param format The formattable message to log
- * @param args Arguments for the message, if an exception is being logged last argument is the throwable.
+ * @param format The formattable message to log.
+ * @param args Arguments for the message. If an exception is being logged, the last argument should be the
+ * {@link Throwable}.
*/
public void error(String format, Object... args) {
log(ERROR_LEVEL, format, args);
@@ -151,10 +155,10 @@ private void log(int logLevel, String format, Object... args) {
}
/**
- * Attempts to log the {@link RuntimeException} at the warning level and returns it to be thrown.
+ * Logs the {@link RuntimeException} at the warning level and returns it to be thrown.
*
* @param runtimeException RuntimeException to be logged and returned.
- * @return the passed {@code RuntimeException}
+ * @return The passed {@code RuntimeException}.
* @throws NullPointerException If {@code runtimeException} is {@code null}.
*/
public RuntimeException logExceptionAsWarning(RuntimeException runtimeException) {
@@ -162,10 +166,10 @@ public RuntimeException logExceptionAsWarning(RuntimeException runtimeException)
}
/**
- * Attempts to log the {@link RuntimeException} at the error level and returns it to be thrown.
+ * Logs the {@link RuntimeException} at the error level and returns it to be thrown.
*
* @param runtimeException RuntimeException to be logged and returned.
- * @return the passed {@code RuntimeException}
+ * @return The passed {@code RuntimeException}.
* @throws NullPointerException If {@code runtimeException} is {@code null}.
*/
public RuntimeException logExceptionAsError(RuntimeException runtimeException) {
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/package-info.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/package-info.java
index 8be79d3fe823..312d35c2a517 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/package-info.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/logging/package-info.java
@@ -2,6 +2,6 @@
// Licensed under the MIT License.
/**
- * Package containing implementation-specific APIs that should not be used by end-users.
+ * Package containing logging APIs.
*/
package com.azure.core.util.logging;
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/package-info.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/package-info.java
index 6a5dc5f88872..2b6e9bec6928 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/util/package-info.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/package-info.java
@@ -2,6 +2,6 @@
// Licensed under the MIT License.
/**
- * Package containing core utility classes
+ * Package containing core utility classes.
*/
package com.azure.core.util;
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/Poller.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/Poller.java
index 0050f79f6d4d..aad002fecdbd 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/Poller.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/Poller.java
@@ -14,11 +14,12 @@
import java.util.function.Function;
/**
- * This class offers API that simplifies the task of executing long-running operations against Azure service.
- * The {@link Poller} consist of poll operation, cancel operation if supported by Azure service and polling interval.
+ * This class offers API that simplifies the task of executing long-running operations against an Azure service.
+ * The {@link Poller} consists of a poll operation, a cancel operation, if it is supported by the Azure service, and a
+ * polling interval.
+ *
*
* It provides the following functionality:
- *
*
* - Querying the current state of long-running operations.
* - Requesting an asynchronous notification for long-running operation's state.
@@ -27,34 +28,34 @@
* - Enable/Disable auto-polling.
*
*
- * Auto Polling
- * Auto-polling is enabled by-default. It means that the {@link Poller} starts polling as soon as its instance is
- * created. The {@link Poller} will transparently call the poll operation every polling cycle and track the state of
- * the long-running operation. Azure services can return {@link PollResponse#getRetryAfter()} to override the
- * {@code Poller.pollInterval} defined in the {@link Poller}. The {@link Poller#getStatus()} represents the status
- * returned by the successful long-running operation at the time the last auto-polling or last manual polling, whichever
- * happened most recently.
+ * Auto polling
+ * Auto-polling is enabled by default. The {@link Poller} starts polling as soon as the instance is created. The
+ * {@link Poller} will transparently call the poll operation every polling cycle and track the state of the
+ * long-running operation. Azure services can return {@link PollResponse#getRetryAfter()} to override the
+ * {@code Poller.pollInterval} defined in the {@link Poller}. {@link #getStatus()} represents the status returned by a
+ * successful long-running operation at the time the last auto-polling or last manual polling, whichever happened most
+ * recently.
*
- * Disable Auto Polling
- * For those scenarios which require manual control of the polling cycle, disable auto-poling by calling
- * {@code setAutoPollingEnabled#false} and perform manual poll by invoking {@link Poller#poll()} function. It will call
- * poll operation once and update the {@link Poller} with the latest status.
+ * Disable auto polling
+ * For those scenarios which require manual control of the polling cycle, disable auto-polling by calling
+ * {@link #setAutoPollingEnabled(boolean) setAutoPollingEnabled(false)}. Then perform manual polling by invoking
+ * {@link #poll()} function. It will call poll operation once and update {@link #getStatus()} with the latest status.
*
- * When auto-polling is disabled, the {@link Poller} will not update its status or other information, unless
- * manual polling is triggered by calling {@link Poller#poll()} function.
+ *
When auto-polling is disabled, the {@link Poller} will not update its status or any other information, unless
+ * manual polling is triggered by calling {@link #poll()} function.
*
- *
The {@link Poller} will stop polling when the long-running operation is complete or it is disabled. The polling
- * is considered complete based on status defined in {@link OperationStatus}.
+ *
The {@link Poller} will stop polling when the long-running operation is complete or disabled. Polling is
+ * considered complete based on status defined in {@link OperationStatus}.
*
- *
Code Samples
+ * Code samples
*
- * Instantiating and Subscribing to Poll Response
+ * Instantiating and subscribing to PollResponse
* {@codesnippet com.azure.core.util.polling.poller.instantiationAndSubscribe}
*
- * Wait/Block for Polling to complete
+ * Wait for polling to complete
* {@codesnippet com.azure.core.util.polling.poller.block}
*
- * Disable auto polling and polling manually
+ * Disable auto polling and poll manually
* {@codesnippet com.azure.core.util.polling.poller.poll-manually}
*
* @param Type of poll response value
@@ -106,20 +107,20 @@ public class Poller {
private Disposable fluxDisposable;
/**
- * Create a {@link Poller} instance with poll interval and poll operation. The polling starts immediately by
+ * Creates a {@link Poller} instance with poll interval and poll operation. The polling starts immediately by
* invoking {@code pollOperation}. The next poll cycle will be defined by {@code retryAfter} value in
* {@link PollResponse}. In absence of {@code retryAfter}, the {@link Poller} will use {@code pollInterval}.
*
- * Code Sample - Create poller object
+ * Create poller object
* {@codesnippet com.azure.core.util.polling.poller.initialize.interval.polloperation}
*
- * @param pollInterval Not-null and greater than zero poll interval.
- * @param pollOperation The polling operation to be called by the {@link Poller} instance. This is a callback into
- * the client library, which must never return {@code null}, and which must always have a non-null
- * {@link OperationStatus}. {@link Mono} returned from poll operation should never return
- * {@link Mono#error(Throwable)}.If any unexpected scenario happens in poll operation, it should be handled by
- * client library and return a valid {@link PollResponse}. However if poll operation returns
- * {@link Mono#error(Throwable)}, the {@link Poller} will disregard that and continue to poll.
+ * @param pollInterval Non null and greater than zero poll interval.
+ * @param pollOperation The polling operation to be called by the {@link Poller} instance. This must never return
+ * {@code null} and always have a non-null {@link OperationStatus}. {@link Mono} returned from poll operation
+ * should never return {@link Mono#error(Throwable)}. If an unexpected scenario happens during the poll
+ * operation, it should be handled by the client library and return a valid {@link PollResponse}. However if
+ * the poll operation returns {@link Mono#error(Throwable)}, the {@link Poller} will disregard it and continue
+ * to poll.
* @throws IllegalArgumentException if {@code pollInterval} is less than or equal to zero and if
* {@code pollInterval} or {@code pollOperation} are {@code null}
*/
@@ -128,20 +129,20 @@ public Poller(Duration pollInterval, Function, Mono, Mono
* It will call cancelOperation if status is {@link OperationStatus#IN_PROGRESS} otherwise it does nothing.
*
- * @throws UnsupportedOperationException when cancel operation is not provided.
+ * @throws UnsupportedOperationException when the cancel operation is not supported by the Azure service.
*/
public void cancelOperation() throws UnsupportedOperationException {
if (this.cancelOperation == null) {
@@ -207,17 +208,14 @@ public Flux> getObserver() {
}
/**
- * Enable user to take control of polling and trigger manual poll operation. It will call poll operation once.
+ * Enables user to take control of polling and trigger manual poll operation. It will call poll operation once.
* This will not turn off auto polling.
*
- * Code Samples
- *
- * Manual Polling
+ * Manual polling
*
* {@codesnippet com.azure.core.util.polling.poller.poll-indepth}
*
- * @return a Mono of {@link PollResponse} This will call poll operation once. The {@link Mono} returned here could
- * be subscribed for receiving {@link PollResponse} in async manner.
+ * @return A {@link Mono} that returns {@link PollResponse}. This will call poll operation once.
*/
public Mono> poll() {
return this.pollOperation.apply(this.pollResponse)
@@ -229,11 +227,12 @@ public Mono> poll() {
}
/**
- * Blocks execution and wait for polling to complete. The polling is considered complete based on status defined in
- * {@link OperationStatus}.
- * It will enable auto-polling if it was disable by user.
+ * Blocks execution and wait for polling to complete. The polling is considered complete based on the status defined
+ * in {@link OperationStatus}.
*
- * @return returns final {@link PollResponse} when polling is complete as defined in {@link OperationStatus}.
+ *
It will enable auto-polling if it was disabled by the user.
+ *
+ * @return A {@link PollResponse} when polling is complete.
*/
public PollResponse block() {
if (!isAutoPollingEnabled()) {
@@ -245,9 +244,8 @@ public PollResponse block() {
/**
* Blocks indefinitely until given {@link OperationStatus} is received.
*
- * @param statusToBlockFor The desired {@link OperationStatus} to block for and it can be any valid
- * {@link OperationStatus} value.
- * @return {@link PollResponse} for matching desired status.
+ * @param statusToBlockFor The desired {@link OperationStatus} to block for.
+ * @return {@link PollResponse} whose {@link PollResponse#getStatus()} matches {@code statusToBlockFor}.
* @throws IllegalArgumentException If {@code statusToBlockFor} is {@code null}.
*/
public PollResponse blockUntil(OperationStatus statusToBlockFor) {
@@ -255,8 +253,8 @@ public PollResponse blockUntil(OperationStatus statusToBlockFor) {
}
/**
- * Blocks until given {@link OperationStatus} is received or a timeout expires if provided. A {@code null}
- * {@code timeout} will cause to block indefinitely for desired status.
+ * Blocks until given {@code statusToBlockFor} is received or the {@code timeout} elapses. If a {@code null}
+ * {@code timeout} is given, it will block indefinitely.
*
* @param statusToBlockFor The desired {@link OperationStatus} to block for and it can be any valid
* {@link OperationStatus} value.
@@ -390,7 +388,7 @@ private boolean activeSubscriber() {
* Indicates if auto polling is enabled. Refer to the {@link Poller} class-level JavaDoc for more details on
* auto-polling.
*
- * @return A boolean value representing if auto-polling is enabled or not..
+ * @return {@code true} if auto-polling is enabled and {@code false} otherwise.
*/
public boolean isAutoPollingEnabled() {
return this.autoPollingEnabled;
@@ -399,7 +397,7 @@ public boolean isAutoPollingEnabled() {
/**
* Current known status as a result of last poll event or last response from a manual polling.
*
- * @return current status or {@code null} if no status is available.
+ * @return Current status or {@code null} if no status is available.
*/
public OperationStatus getStatus() {
return this.pollResponse != null ? this.pollResponse.getStatus() : null;
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/package-info.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/package-info.java
index e7e0c829d864..719d9b67f3c5 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/package-info.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/package-info.java
@@ -2,6 +2,6 @@
// Licensed under the MIT License.
/**
- * Package containing API for Long Running Operations.
+ * Package containing API for long running operations.
*/
package com.azure.core.util.polling;
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/tracing/Tracer.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/tracing/Tracer.java
index 80d90c1481d2..a1752b8d26f0 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/util/tracing/Tracer.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/tracing/Tracer.java
@@ -6,8 +6,9 @@
import com.azure.core.util.Context;
/**
- * Contract that all tracers must implement to be plug-able into the SDK.
+ * Contract that all tracers must implement to be pluggable into the SDK.
*
+ * @see TracerProxy
*/
public interface Tracer {
/**
@@ -33,28 +34,25 @@ public interface Tracer {
/**
* Key for {@link Context} which indicates that the context contains the hostname.
- *
*/
String HOST_NAME = "hostname";
/**
* Key for {@link Context} which indicates that the context contains a message span context.
- *
*/
String SPAN_CONTEXT = "span-context";
/**
* Key for {@link Context} which indicates that the context contains a "Diagnostic Id" for the service call.
- *
*/
String DIAGNOSTIC_ID_KEY = "diagnostic-id";
/**
* Creates a new tracing span.
*
- * The {@code context} will be checked for containing information about a parent span. If a parent span is found,
- * the new span will be added as a child. Otherwise the parent span will be created and added to the {@code context}
- * and any downstream {@code start()} calls will use the created span as the parent.
+ * The {@code context} will be checked for information about a parent span. If a parent span is found, the new span
+ * will be added as a child. Otherwise, the parent span will be created and added to the {@code context} and any
+ * downstream {@code start()} calls will use the created span as the parent.
*
*
Code samples
*
@@ -73,8 +71,8 @@ public interface Tracer {
* Creates a new tracing span for AMQP calls.
*
*
- * The {@code context} will be checked for containing information about a parent span. If a parent span is found the
- * new span will be added as a child. Otherwise the span will be created and added to the {@code context} and any
+ * The {@code context} will be checked for information about a parent span. If a parent span is found, the new span
+ * will be added as a child. Otherwise, the parent span will be created and added to the {@code context} and any
* downstream {@code start()} calls will use the created span as the parent.
*
*
@@ -126,14 +124,14 @@ public interface Tracer {
void end(int responseCode, Throwable error, Context context);
/**
- * Completes the current tracing span.
+ * Completes the current tracing span for AMQP calls.
*
*
Code samples
*
* Completes the tracing span with the corresponding OpenCensus status for the given status message
* {@codesnippet com.azure.core.util.tracing.end#string-throwable-context}
*
- * @param statusMessage the error or success message that occurred during the call, or {@code null} if no error
+ * @param statusMessage The error or success message that occurred during the call, or {@code null} if no error
* occurred.
* @param error {@link Throwable} that happened during the span or {@code null} if no exception occurred.
* @param context Additional metadata that is passed through the call stack.
@@ -142,8 +140,7 @@ public interface Tracer {
void end(String statusMessage, Throwable error, Context context);
/**
- * Adds metadata to the current span. The {@code context} is checked for having span information, if no span
- * information is found in the context no metadata is added.
+ * Adds metadata to the current span. If no span information is found in the context, then no metadata is added.
*
* @param key Name of the metadata.
* @param value Value of the metadata.
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/tracing/TracerProxy.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/tracing/TracerProxy.java
index 780b613af31f..c508e4390d84 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/util/tracing/TracerProxy.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/tracing/TracerProxy.java
@@ -9,6 +9,8 @@
/**
* This class provides a means for all client libraries to augment the context information they have received from an
* end user with additional distributed tracing information, that may then be passed on to a backend for analysis.
+ *
+ * @see Tracer
*/
public final class TracerProxy {
@@ -19,15 +21,16 @@ private TracerProxy() {
}
/**
- * For each tracer plugged into the SDK a new tracing span is created.
+ * A new tracing span is created for each {@link Tracer tracer} plugged into the SDK.
*
- * The {@code context} will be checked for containing information about a parent span. If a parent span is found the
- * new span will be added as a child, otherwise the span will be created and added to the context and any downstream
- * start calls will use the created span as the parent.
+ * The {@code context} will be checked for information about a parent span. If a parent span is found, the new span
+ * will be added as a child. Otherwise, the parent span will be created and added to the {@code context} and any
+ * downstream {@code start()} calls will use the created span as the parent.
*
* @param methodName Name of the method triggering the span creation.
* @param context Additional metadata that is passed through the call stack.
- * @return An updated context object.
+ *
+ * @return An updated {@link Context} object.
*/
public static Context start(String methodName, Context context) {
Context local = context;
@@ -39,8 +42,8 @@ public static Context start(String methodName, Context context) {
}
/**
- * For each tracer plugged into the SDK metadata to its current span. The {@code context} is checked for having span
- * information, if no span information is found in the context no metadata is added.
+ * For each {@link Tracer tracer} plugged into the SDK, the key-value pair metadata is added to its current span. If
+ * the {@code context} does not contain a span, then no metadata is added.
*
* @param key Name of the metadata.
* @param value Value of the metadata.
@@ -51,10 +54,10 @@ public static void setAttribute(String key, String value, Context context) {
}
/**
- * For each tracer plugged into the SDK the current tracing span is marked as completed.
+ * For each {@link Tracer tracer} plugged into the SDK, its current tracing span is marked as completed.
*
* @param responseCode Response status code if the span is in a HTTP call context.
- * @param error Potential throwable that happened during the span.
+ * @param error {@link Throwable} that happened during the span or {@code null} if no exception occurred.
* @param context Additional metadata that is passed through the call stack.
*/
public static void end(int responseCode, Throwable error, Context context) {
@@ -62,11 +65,12 @@ public static void end(int responseCode, Throwable error, Context context) {
}
/**
- * For each tracer plugged into the SDK the span name is set.
+ * Sets the span name for each {@link Tracer tracer} plugged into the SDK.
*
* @param spanName Name of the span.
* @param context Additional metadata that is passed through the call stack.
- * @return An updated context object.
+ *
+ * @return An updated {@link Context} object.
*/
public static Context setSpanName(String spanName, Context context) {
Context local = context;
diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/implementation/util/ClientLoggerJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/logging/ClientLoggerJavaDocCodeSnippets.java
similarity index 64%
rename from sdk/core/azure-core/src/samples/java/com/azure/core/implementation/util/ClientLoggerJavaDocCodeSnippets.java
rename to sdk/core/azure-core/src/samples/java/com/azure/core/util/logging/ClientLoggerJavaDocCodeSnippets.java
index c04294739668..f621b764c043 100644
--- a/sdk/core/azure-core/src/samples/java/com/azure/core/implementation/util/ClientLoggerJavaDocCodeSnippets.java
+++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/logging/ClientLoggerJavaDocCodeSnippets.java
@@ -1,9 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-package com.azure.core.implementation.util;
+package com.azure.core.util.logging;
-import com.azure.core.util.logging.ClientLogger;
import java.io.File;
import java.io.IOException;
@@ -20,26 +19,27 @@ public void loggingSnippets() {
ClientLogger logger = new ClientLogger(ClientLoggerJavaDocCodeSnippets.class);
String name = getName();
- // BEGIN: com.azure.core.implementation.util.clientlogger.verbose
+ // BEGIN: com.azure.core.util.logging.clientlogger.verbose
logger.verbose("A formattable message. Hello, {}", name);
- // END: com.azure.core.implementation.util.clientlogger.verbose
+ // END: com.azure.core.util.logging.clientlogger.verbose
- // BEGIN: com.azure.core.implementation.util.clientlogger.info
+ // BEGIN: com.azure.core.util.logging.clientlogger.info
logger.info("A formattable message. Hello, {}", name);
- // END: com.azure.core.implementation.util.clientlogger.info
+ // END: com.azure.core.util.logging.clientlogger.info
- // BEGIN: com.azure.core.implementation.util.clientlogger.warning
- logger.warning("A formattable message. Hello, {}", name);
- // END: com.azure.core.implementation.util.clientlogger.warning
+ // BEGIN: com.azure.core.util.logging.clientlogger.warning
+ Throwable exception = new IllegalArgumentException("An invalid argument was encountered.");
+ logger.warning("A formattable message. Hello, {}", name, exception);
+ // END: com.azure.core.util.logging.clientlogger.warning
File resource = getFile();
- // BEGIN: com.azure.core.implementation.util.clientlogger.error
+ // BEGIN: com.azure.core.util.logging.clientlogger.error
try {
upload(resource);
} catch (IOException ex) {
logger.error("A formattable message. Hello, {}", name, ex);
}
- // END: com.azure.core.implementation.util.clientlogger.error
+ // END: com.azure.core.util.logging.clientlogger.error
}
/**
diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollerJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollerJavaDocCodeSnippets.java
index acbdf8420ba8..d8446a658d86 100644
--- a/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollerJavaDocCodeSnippets.java
+++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollerJavaDocCodeSnippets.java
@@ -4,80 +4,41 @@
package com.azure.core.util.polling;
+import com.azure.core.util.polling.PollResponse.OperationStatus;
import reactor.core.publisher.Mono;
import java.time.Duration;
import java.time.LocalDateTime;
-import java.util.function.Function;
-import com.azure.core.util.polling.PollResponse.OperationStatus;
+import java.util.function.Predicate;
/**
* This class contains code samples for generating javadocs through doclets for {@link Poller}
*/
public final class PollerJavaDocCodeSnippets {
-
- private boolean debug = true;
-
- private Function, Mono>> createPollOperation(
- PollResponse inProResp,
- PollResponse finalPollResponse,
- long sendFinalResponseInMillis
- ) {
- return new Function, Mono>>() {
-
- // Will return success after this time.
- LocalDateTime timeToReturnFinalResponse
- = LocalDateTime.now().plus(Duration.ofMillis(sendFinalResponseInMillis));
-
- @Override
- public Mono> apply(PollResponse prePollResponse) {
- if (LocalDateTime.now().isBefore(timeToReturnFinalResponse)) {
- System.out.println(" Service poll function called returning intermediate response "
- + inProResp.getValue());
- return Mono.just(inProResp);
- } else {
- System.out.println(" Service poll function called returning final response "
- + finalPollResponse.getValue());
- return Mono.just(finalPollResponse);
- }
- }
- };
- }
+ private final Poller myPoller = new Poller<>(Duration.ofMillis(100),
+ response -> Mono.just(new PollResponse<>(OperationStatus.SUCCESSFULLY_COMPLETED, "Completed")));
/**
* Initialise
*/
public void initialize() {
- PollResponse finalPollResponse =
- new PollResponse(OperationStatus.SUCCESSFULLY_COMPLETED, ("Operation Completed."));
- PollResponse inProgressResp =
- new PollResponse(OperationStatus.IN_PROGRESS, "Operation in progress.");
-
- long totalTimeoutInMillis = 1000 * 2;
// BEGIN: com.azure.core.util.polling.poller.initialize.interval.polloperation
- // Define your custom poll operation
- Function, Mono>> pollOperation =
- new Function, Mono>>() {
- // Will return success after this time.
- LocalDateTime timeToReturnFinalResponse
- = LocalDateTime.now().plus(Duration.ofMillis(800));
- @Override
- public Mono> apply(PollResponse prePollResponse) {
- if (LocalDateTime.now().isBefore(timeToReturnFinalResponse)) {
- System.out.println("returning intermediate response " + inProgressResp.getValue());
- return Mono.just(inProgressResp);
- } else {
- System.out.println("returning final response " + finalPollResponse.getValue());
- return Mono.just(finalPollResponse);
- }
- }
- };
+ LocalDateTime timeToReturnFinalResponse = LocalDateTime.now().plus(Duration.ofMillis(800));
- //Create poller instance
- Poller myPoller = new Poller<>(Duration.ofMillis(100), pollOperation);
+ // Create poller instance
+ Poller poller = new Poller<>(Duration.ofMillis(100),
+ // Define your custom poll operation
+ perPollResponse -> {
+ if (LocalDateTime.now().isBefore(timeToReturnFinalResponse)) {
+ System.out.println("Returning intermediate response.");
+ return Mono.just(new PollResponse<>(OperationStatus.IN_PROGRESS, "Operation in progress."));
+ } else {
+ System.out.println("Returning final response.");
+ return Mono.just(new PollResponse<>(OperationStatus.SUCCESSFULLY_COMPLETED, "Operation completed."));
+ }
+ });
// Default polling will start transparently.
-
// END: com.azure.core.util.polling.poller.initialize.interval.polloperation
}
@@ -85,40 +46,27 @@ public Mono> apply(PollResponse prePollResponse) {
* Initialise and subscribe snippet
*/
public void initializeAndSubscribe() {
- PollResponse finalPollResponse =
- new PollResponse(OperationStatus.SUCCESSFULLY_COMPLETED, ("Operation Completed."));
- PollResponse inProgressResp =
- new PollResponse(OperationStatus.IN_PROGRESS, "Operation in progress.");
-
- long totalTimeoutInMillis = 1000 * 2;
// BEGIN: com.azure.core.util.polling.poller.instantiationAndSubscribe
+ LocalDateTime timeToReturnFinalResponse = LocalDateTime.now().plus(Duration.ofMillis(800));
+
+ // Create poller instance
Duration pollInterval = Duration.ofMillis(100);
- // Assumption : Poll Operation will return a String type in our example.
- Function, Mono>> pollOperation =
- new Function, Mono>>() {
- // Will return success after this time.
- LocalDateTime timeToReturnFinalResponse
- = LocalDateTime.now().plus(Duration.ofMillis(800));
-
- @Override
- public Mono> apply(PollResponse prePollResponse) {
- if (LocalDateTime.now().isBefore(timeToReturnFinalResponse)) {
- System.out.println("returning intermediate response " + inProgressResp.getValue());
- return Mono.just(inProgressResp);
- } else {
- System.out.println("returning final response " + finalPollResponse.getValue());
- return Mono.just(finalPollResponse);
- }
+ Poller poller = new Poller<>(pollInterval,
+ // Define your custom poll operation
+ prePollResponse -> {
+ if (LocalDateTime.now().isBefore(timeToReturnFinalResponse)) {
+ System.out.println("Returning intermediate response.");
+ return Mono.just(new PollResponse<>(OperationStatus.IN_PROGRESS, "Operation in progress."));
+ } else {
+ System.out.println("Returning final response.");
+ return Mono.just(new PollResponse<>(OperationStatus.SUCCESSFULLY_COMPLETED, "Operation Completed."));
}
- };
-
- //Create poller instance
- Poller myPoller = new Poller<>(pollInterval, pollOperation);
+ });
// Listen to poll responses
- myPoller.getObserver().subscribe(pr -> {
- //process poll response
- System.out.println("Got Response status,value " + pr.getStatus().toString() + " " + pr.getValue());
+ poller.getObserver().subscribe(response -> {
+ // Process poll response
+ System.out.printf("Got response. Status: %s, Value: %s%n", response.getStatus(), response.getValue());
});
// Do something else
@@ -129,13 +77,9 @@ public Mono> apply(PollResponse prePollResponse) {
* block for response
*/
public void block() {
-
- Poller myPoller = null;
-
// BEGIN: com.azure.core.util.polling.poller.block
- PollResponse myFinalResponse = myPoller.block();
- System.out.println("Polling complete final status , value= "
- + myFinalResponse.getStatus().toString() + "," + myFinalResponse.getValue());
+ PollResponse response = myPoller.block();
+ System.out.printf("Polling complete. Status: %s, Value: %s%n", response.getStatus(), response.getValue());
// END: com.azure.core.util.polling.poller.block
}
@@ -143,12 +87,9 @@ public void block() {
* disable auto polling
*/
public void setAutoPollingFalse() {
-
- Poller myPoller = null;
-
// BEGIN: com.azure.core.util.polling.poller.disableautopolling
myPoller.setAutoPollingEnabled(false);
- System.out.println("Polling Enabled ? " + myPoller.isAutoPollingEnabled());
+ System.out.println("Polling Enabled? " + myPoller.isAutoPollingEnabled());
// END: com.azure.core.util.polling.poller.disableautopolling
}
@@ -156,12 +97,9 @@ public void setAutoPollingFalse() {
* enable auto polling
*/
public void setAutoPollingTrue() {
-
- Poller myPoller = null;
-
// BEGIN: com.azure.core.util.polling.poller.enableautopolling
myPoller.setAutoPollingEnabled(true);
- System.out.println("Polling Enabled ? " + myPoller.isAutoPollingEnabled());
+ System.out.println("Polling Enabled? " + myPoller.isAutoPollingEnabled());
// END: com.azure.core.util.polling.poller.enableautopolling
}
@@ -170,52 +108,45 @@ public void setAutoPollingTrue() {
* manual auto polling.
*/
public void poll() {
-
- Poller myPoller = null;
-
// BEGIN: com.azure.core.util.polling.poller.poll-manually
+ // Turns off auto polling.
myPoller.setAutoPollingEnabled(false);
- PollResponse pollResponse = null;
- // We assume that we get SUCCESSFULLY_COMPLETED status from pollOperation when polling is complete.
- while (pollResponse != null
- && pollResponse.getStatus() != OperationStatus.SUCCESSFULLY_COMPLETED) {
- pollResponse = myPoller.poll().block();
- try {
- // Ensure that you have sufficient wait in each poll() which is suitable for your application.
- Thread.sleep(500);
- } catch (InterruptedException e) {
- }
- }
- System.out.println("Polling complete with status " + myPoller.getStatus().toString());
+
+ // Continue to poll every 500ms until the response emitted from poll() is SUCCESSFULLY_COMPLETED.
+ myPoller.poll()
+ .repeatWhen(attemptsCompleted -> attemptsCompleted.flatMap(attempt -> Mono.delay(Duration.ofMillis(500))))
+ .takeUntil(response -> response.getStatus() == OperationStatus.SUCCESSFULLY_COMPLETED)
+ .subscribe(
+ response -> System.out.printf("Status: %s. Value: %s%n", response.getStatus(), response.getValue()),
+ error -> System.err.printf("Exception occurred while polling: %s%n", error),
+ () -> System.out.printf("Polling complete with status: %s%n", myPoller.getStatus()));
// END: com.azure.core.util.polling.poller.poll-manually
}
/**
- * manual auto polling. More indepth example
+ * manual auto polling. More in-depth example
*/
public void pollIndepth() {
-
- Poller myPoller = null;
-
// BEGIN: com.azure.core.util.polling.poller.poll-indepth
- // Turn off auto polling and this code will take control of polling
+ final Predicate> isComplete = response -> {
+ return response.getStatus() != OperationStatus.IN_PROGRESS
+ && response.getStatus() != OperationStatus.NOT_STARTED;
+ };
+
+ // Turns off auto polling
myPoller.setAutoPollingEnabled(false);
- PollResponse pollResponse = null;
- while (pollResponse == null
- || pollResponse.getStatus() == OperationStatus.IN_PROGRESS
- || pollResponse.getStatus() == OperationStatus.NOT_STARTED) {
- // get one poll Response at a time..
- pollResponse = myPoller.poll().block();
- System.out.println("Poll response status " + pollResponse.getStatus().toString());
- // Ensure that you have sufficient wait in each poll() which is suitable for your application.
- try {
- // wait before next poll.
- Thread.sleep(500);
- } catch (InterruptedException e) {
- }
- }
- System.out.println("Polling complete with status " + myPoller.getStatus().toString());
+ myPoller.poll()
+ .repeatWhen(attemptsCompleted -> {
+ // Retry each poll operation after 500ms.
+ return attemptsCompleted.flatMap(attempt -> Mono.delay(Duration.ofMillis(500)));
+ })
+ .takeUntil(isComplete)
+ .filter(isComplete)
+ .subscribe(completed -> {
+ System.out.println("Completed poll response: " + completed.getStatus());
+ System.out.println("Polling complete with status: " + myPoller.getStatus().toString());
+ });
// END: com.azure.core.util.polling.poller.poll-indepth
}
}
From ce3e131b6ddaa4368eb9f1eba09b3e11f5bbfa4e Mon Sep 17 00:00:00 2001
From: Sima Zhu <48036328+sima-zhu@users.noreply.github.com>
Date: Fri, 4 Oct 2019 12:23:15 -0700
Subject: [PATCH 13/18] Storage InputStream and OutputStream (#5455)
---
.../resources/spotbugs/spotbugs-exclude.xml | 8 +
.../blob/specialized/BlobInputStream.java | 351 +---------------
.../blob/specialized/BlobOutputStream.java | 168 ++------
.../blob/specialized/PageBlobClient.java | 18 +-
.../storage/blob/BlobOutputStreamTest.groovy | 9 +-
.../BlockBlobInputOutputStreamTest.groovy | 13 +-
.../blob/specialized/BlockBlobAPITest.groovy | 15 +-
.../storage/common/StorageInputStream.java | 391 ++++++++++++++++++
.../storage/common/StorageOutputStream.java | 155 +++++++
.../com/azure/storage/file/FileClient.java | 49 ++-
.../storage/file/StorageFileInputStream.java | 74 ++++
.../storage/file/StorageFileOutputStream.java | 49 +++
.../azure/storage/file/models/FileRange.java | 43 +-
.../com/azure/storage/file/APISpec.groovy | 14 +-
.../StorageFileInputOutputStreamTests.groovy | 77 ++++
...nputOutputStreamTestsStreamOverLimits.json | 54 +++
16 files changed, 982 insertions(+), 506 deletions(-)
create mode 100644 sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/StorageInputStream.java
create mode 100644 sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/StorageOutputStream.java
create mode 100644 sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/StorageFileInputStream.java
create mode 100644 sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/StorageFileOutputStream.java
create mode 100644 sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/StorageFileInputOutputStreamTests.groovy
create mode 100644 sdk/storage/azure-storage-file/src/test/resources/session-records/StorageFileInputOutputStreamTestsStreamOverLimits.json
diff --git a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml
index fdf1ecab7e2c..7974e0546cd5 100755
--- a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml
+++ b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml
@@ -456,6 +456,7 @@
+
@@ -623,4 +624,11 @@
RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE,
UPM_UNCALLED_PRIVATE_METHOD"/>
+
+
+
+
+
+
+
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobInputStream.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobInputStream.java
index b0033ae94ac5..015798e972c6 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobInputStream.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobInputStream.java
@@ -4,21 +4,20 @@
import com.azure.core.implementation.util.FluxUtil;
import com.azure.core.util.logging.ClientLogger;
-import com.azure.storage.blob.BlobProperties;
+import com.azure.storage.blob.BlobAsyncClient;
import com.azure.storage.blob.models.BlobAccessConditions;
import com.azure.storage.blob.models.BlobRange;
import com.azure.storage.blob.models.StorageException;
import com.azure.storage.common.Constants;
-import com.azure.storage.common.SR;
+import com.azure.storage.common.StorageInputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.nio.ByteBuffer;
/**
* Provides an input stream to read a given blob resource.
*/
-public final class BlobInputStream extends InputStream {
+public final class BlobInputStream extends StorageInputStream {
private final ClientLogger logger = new ClientLogger(BlobInputStream.class);
/**
@@ -26,76 +25,20 @@ public final class BlobInputStream extends InputStream {
*/
private final BlobAsyncClientBase blobClient;
- /**
- * A flag to determine if the stream is faulted, if so the last error will be thrown on next operation.
- */
- private volatile boolean streamFaulted;
-
- /**
- * Holds the last exception this stream encountered.
- */
- private IOException lastError;
-
- /**
- * Holds the stream length.
- */
- private final long streamLength;
-
- /**
- * Holds the stream read size for both block and page blobs.
- */
- private final int readSize;
-
- /**
- * Holds the reference to the current buffered data.
- */
- private ByteBuffer currentBuffer;
-
- /**
- * Holds an absolute byte position for the mark feature.
- */
- private long markedPosition;
-
- /**
- * Holds the mark delta for which the mark position is expired.
- */
- private int markExpiry;
-
- /**
- * Holds an absolute byte position of the current read position.
- */
- private long currentAbsoluteReadPosition;
-
- /**
- * Holds the absolute byte position of the start of the current buffer.
- */
- private long bufferStartOffset;
-
- /**
- * Holds the length of the current buffer in bytes.
- */
- private int bufferSize;
-
/**
* Holds the {@link BlobAccessConditions} object that represents the access conditions for the blob.
*/
private final BlobAccessConditions accessCondition;
- /**
- * Offset of the source blob this class is configured to stream from.
- */
- private final long blobRangeOffset;
-
/**
* Initializes a new instance of the BlobInputStream class.
*
- * @param blobClient A {@link BlobAsyncClientBase} object which represents the blob that this stream is associated
- * with.
+ * @param blobClient A {@link BlobAsyncClient} object which represents the blob that this stream is associated with.
* @param accessCondition An {@link BlobAccessConditions} object which represents the access conditions for the
* blob.
* @throws StorageException An exception representing any error which occurred during the operation.
*/
- BlobInputStream(final BlobAsyncClientBase blobClient, final BlobAccessConditions accessCondition)
+ BlobInputStream(final BlobAsyncClient blobClient, final BlobAccessConditions accessCondition)
throws StorageException {
this(blobClient, 0, null, accessCondition);
}
@@ -113,61 +56,15 @@ public final class BlobInputStream extends InputStream {
* @throws StorageException An exception representing any error which occurred during the operation.
*/
BlobInputStream(final BlobAsyncClientBase blobClient, long blobRangeOffset, Long blobRangeLength,
- final BlobAccessConditions accessCondition)
+ final BlobAccessConditions accessCondition)
throws StorageException {
+ super(blobRangeOffset, blobRangeLength, 4 * Constants.MB,
+ blobClient.getProperties().block().getBlobSize());
- this.blobRangeOffset = blobRangeOffset;
this.blobClient = blobClient;
- this.streamFaulted = false;
- this.currentAbsoluteReadPosition = blobRangeOffset;
- this.readSize = 4 * Constants.MB;
this.accessCondition = accessCondition;
- if (blobRangeOffset < 0 || (blobRangeLength != null && blobRangeLength <= 0)) {
- throw new IndexOutOfBoundsException();
- }
-
- BlobProperties properties = blobClient.getProperties().block();
- this.streamLength = blobRangeLength == null
- ? properties.getBlobSize() - this.blobRangeOffset
- : Math.min(properties.getBlobSize() - this.blobRangeOffset, blobRangeLength);
-
- this.reposition(blobRangeOffset);
- }
-
- /**
- * Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without
- * blocking by the next invocation of a method for this input stream. The next invocation might be the same thread
- * or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes.
- *
- * @return An int which represents an estimate of the number of bytes that can be read (or skipped
- * over) from this input stream without blocking, or 0 when it reaches the end of the input stream.
- */
- @Override
- public synchronized int available() {
- return this.bufferSize - (int) (this.currentAbsoluteReadPosition - this.bufferStartOffset);
- }
-
- /**
- * Helper function to check if the stream is faulted, if it is it surfaces the exception.
- *
- * @throws IOException If an I/O error occurs. In particular, an IOException may be thrown if the output stream has
- * been closed.
- */
- private synchronized void checkStreamState() throws IOException {
- if (this.streamFaulted) {
- throw this.lastError;
- }
- }
- /**
- * Closes this input stream and releases any system resources associated with the stream.
- */
- @Override
- public synchronized void close() {
- this.currentBuffer = null;
- this.streamFaulted = true;
- this.lastError = new IOException(SR.STREAM_CLOSED);
}
/**
@@ -177,15 +74,17 @@ public synchronized void close() {
* @param readLength An int which represents the number of bytes to read.
* @throws IOException If an I/O error occurs.
*/
- private synchronized void dispatchRead(final int readLength) throws IOException {
+ @Override
+ protected synchronized ByteBuffer dispatchRead(final int readLength, final long offset) throws IOException {
try {
- this.currentBuffer = this.blobClient.downloadWithResponse(new BlobRange(this.currentAbsoluteReadPosition,
+ ByteBuffer currentBuffer = this.blobClient.downloadWithResponse(new BlobRange(offset,
(long) readLength), null, this.accessCondition, false)
.flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.getValue()).map(ByteBuffer::wrap))
.block();
this.bufferSize = readLength;
- this.bufferStartOffset = this.currentAbsoluteReadPosition;
+ this.bufferStartOffset = offset;
+ return currentBuffer;
} catch (final StorageException e) {
this.streamFaulted = true;
this.lastError = new IOException(e);
@@ -193,228 +92,4 @@ private synchronized void dispatchRead(final int readLength) throws IOException
}
}
- /**
- * Marks the current position in this input stream. A subsequent call to the reset method repositions this stream at
- * the last marked position so that subsequent reads re-read the same bytes.
- *
- * @param readlimit An int which represents the maximum limit of bytes that can be read before the mark
- * position becomes invalid.
- */
- @Override
- public synchronized void mark(final int readlimit) {
- this.markedPosition = this.currentAbsoluteReadPosition;
- this.markExpiry = readlimit;
- }
-
- /**
- * Tests if this input stream supports the mark and reset methods. Whether or not mark and reset are supported is an
- * invariant property of a particular input stream instance. The markSupported method of {@link InputStream} returns
- * false.
- *
- * @return True if this stream instance supports the mark and reset methods; False
- * otherwise.
- */
- @Override
- public boolean markSupported() {
- return true;
- }
-
- /**
- * Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If
- * no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks
- * until input data is available, the end of the stream is detected, or an exception is thrown.
- *
- * @return An int which represents the total number of bytes read into the buffer, or -1 if there is no
- * more data because the end of the stream has been reached.
- * @throws IOException If an I/O error occurs.
- */
- @Override
- public int read() throws IOException {
- final byte[] tBuff = new byte[1];
- final int numberOfBytesRead = this.read(tBuff, 0, 1);
-
- if (numberOfBytesRead > 0) {
- return tBuff[0] & 0xFF;
- } else if (numberOfBytesRead == 0) {
- throw new IOException(SR.UNEXPECTED_STREAM_READ_ERROR);
- } else {
- return -1;
- }
- }
-
- /**
- * Reads some number of bytes from the input stream and stores them into the buffer array b. The number
- * of bytes actually read is returned as an integer. This method blocks until input data is available, end of file
- * is detected, or an exception is thrown. If the length of b is zero, then no bytes are read and 0 is
- * returned; otherwise, there is an attempt to read at least one byte. If no byte is available because the stream is
- * at the end of the file, the value -1 is returned; otherwise, at least one byte is read and stored into
- * b.
- *
- * The first byte read is stored into element b[0], the next one into b[1], and so on. The
- * number of bytes read is, at most, equal to the length of b. Let k be the number of
- * bytes actually read; these bytes will be stored in elements b[0] through b[k-1],
- * leaving elements b[k] through
- * b[b.length-1] unaffected.
- *
- * The read(b) method for class {@link InputStream} has the same effect as:
- *
- * read(b, 0, b.length)
- *
- * @param b A byte array which represents the buffer into which the data is read.
- * @throws IOException If the first byte cannot be read for any reason other than the end of the file, if the input
- * stream has been closed, or if some other I/O error occurs.
- * @throws NullPointerException If the byte array b is null.
- */
- @Override
- public int read(final byte[] b) throws IOException {
- return this.read(b, 0, b.length);
- }
-
- /**
- * Reads up to len bytes of data from the input stream into an array of bytes. An attempt is made to
- * read as many as len bytes, but a smaller number may be read. The number of bytes actually read is
- * returned as an integer. This method blocks until input data is available, end of file is detected, or an
- * exception is thrown.
- *
- * If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at
- * least one byte. If no byte is available because the stream is at end of file, the value -1 is returned;
- * otherwise, at least one byte is read and stored into b.
- *
- * The first byte read is stored into element b[off], the next one into b[off+1], and so
- * on. The number of bytes read is, at most, equal to len. Let k be the number of bytes
- * actually read; these bytes will be stored in elements b[off] through b[off+k-1],
- * leaving elements b[off+k] through
- * b[off+len-1] unaffected.
- *
- * In every case, elements b[0] through b[off] and elements b[off+len]
- * through b[b.length-1] are unaffected.
- *
- * The read(b, off, len) method for class {@link InputStream} simply calls the method
- * read() repeatedly. If the first such
- * call results in an IOException, that exception is returned from the call to the
- * read(b, off, len) method. If any
- * subsequent call to read() results in a IOException, the exception is caught and treated
- * as if it were end of file; the bytes read up to that point are stored into b and the number of bytes
- * read before the exception occurred is returned. The default implementation of this method blocks until the
- * requested amount of input data
- * len has been read, end of file is detected, or an exception is thrown. Subclasses are encouraged to
- * provide a more efficient implementation of this method.
- *
- * @param b A byte array which represents the buffer into which the data is read.
- * @param off An int which represents the start offset in the byte array at which the data
- * is written.
- * @param len An int which represents the maximum number of bytes to read.
- * @return An int which represents the total number of bytes read into the buffer, or -1 if there is no
- * more data because the end of the stream has been reached.
- * @throws IOException If the first byte cannot be read for any reason other than end of file, or if the input
- * stream has been closed, or if some other I/O error occurs.
- * @throws NullPointerException If the byte array b is null.
- * @throws IndexOutOfBoundsException If off is negative, len is negative, or
- * len is greater than
- * b.length - off.
- */
- @Override
- public int read(final byte[] b, final int off, final int len) throws IOException {
- if (off < 0 || len < 0 || len > b.length - off) {
- throw logger.logExceptionAsError(new IndexOutOfBoundsException());
- }
-
- return this.readInternal(b, off, len);
- }
-
- /**
- * Performs internal read to the given byte buffer.
- *
- * @param b A byte array which represents the buffer into which the data is read.
- * @param off An int which represents the start offset in the byte array b at
- * which the data is written.
- * @param len An int which represents the maximum number of bytes to read.
- * @return An int which represents the total number of bytes read into the buffer, or -1 if there is no
- * more data because the end of the stream has been reached.
- * @throws IOException If the first byte cannot be read for any reason other than end of file, or if the input
- * stream has been closed, or if some other I/O error occurs.
- */
- private synchronized int readInternal(final byte[] b, final int off, int len) throws IOException {
- this.checkStreamState();
-
- // if buffer is empty do next get operation
- if ((this.currentBuffer == null || this.currentBuffer.remaining() == 0)
- && this.currentAbsoluteReadPosition < this.streamLength + this.blobRangeOffset) {
- this.dispatchRead((int) Math.min(this.readSize,
- this.streamLength + this.blobRangeOffset - this.currentAbsoluteReadPosition));
- }
-
- len = Math.min(len, this.readSize);
-
- final int numberOfBytesRead;
- if (currentBuffer == null || currentBuffer.remaining() == 0) {
- numberOfBytesRead = -1;
- } else {
- numberOfBytesRead = Math.min(len, this.currentBuffer.remaining());
- // do read from buffer
- this.currentBuffer = this.currentBuffer.get(b, off, numberOfBytesRead);
- }
-
- if (numberOfBytesRead > 0) {
- this.currentAbsoluteReadPosition += numberOfBytesRead;
- }
-
- // update markers
- if (this.markExpiry > 0 && this.markedPosition + this.markExpiry < this.currentAbsoluteReadPosition) {
- this.markedPosition = this.blobRangeOffset;
- this.markExpiry = 0;
- }
-
- return numberOfBytesRead;
- }
-
- /**
- * Repositions the stream to the given absolute byte offset.
- *
- * @param absolutePosition A long which represents the absolute byte offset withitn the stream
- * reposition.
- */
- private synchronized void reposition(final long absolutePosition) {
- this.currentAbsoluteReadPosition = absolutePosition;
- this.currentBuffer = ByteBuffer.allocate(0);
- this.bufferStartOffset = absolutePosition;
- }
-
- /**
- * Repositions this stream to the position at the time the mark method was last called on this input stream. Note
- * repositioning the blob read stream will disable blob MD5 checking.
- *
- * @throws IOException If this stream has not been marked or if the mark has been invalidated.
- */
- @Override
- public synchronized void reset() throws IOException {
- if (this.markedPosition + this.markExpiry < this.currentAbsoluteReadPosition) {
- throw new IOException(SR.MARK_EXPIRED);
- }
- this.reposition(this.markedPosition);
- }
-
- /**
- * Skips over and discards n bytes of data from this input stream. The skip method may, for a variety of reasons,
- * end up skipping over some smaller number of bytes, possibly 0. This may result from any of a number of
- * conditions; reaching end of file before n bytes have been skipped is only one possibility. The actual number of
- * bytes skipped is returned. If n is negative, no bytes are skipped.
- *
- * Note repositioning the blob read stream will disable blob MD5 checking.
- *
- * @param n A long which represents the number of bytes to skip.
- */
- @Override
- public synchronized long skip(final long n) {
- if (n == 0) {
- return 0;
- }
-
- if (n < 0 || this.currentAbsoluteReadPosition + n > this.streamLength + this.blobRangeOffset) {
- throw logger.logExceptionAsError(new IndexOutOfBoundsException());
- }
-
- this.reposition(this.currentAbsoluteReadPosition + n);
- return n;
- }
}
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobOutputStream.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobOutputStream.java
index acf6d1e6d2a8..0128c8164d3e 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobOutputStream.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobOutputStream.java
@@ -2,7 +2,7 @@
// Licensed under the MIT License.
package com.azure.storage.blob.specialized;
-import com.azure.storage.blob.BlobAsyncClient;
+import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.models.AppendBlobAccessConditions;
import com.azure.storage.blob.models.AppendPositionAccessConditions;
import com.azure.storage.blob.models.BlobAccessConditions;
@@ -11,13 +11,12 @@
import com.azure.storage.blob.models.PageRange;
import com.azure.storage.blob.models.StorageException;
import com.azure.storage.common.SR;
+import com.azure.storage.common.StorageOutputStream;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;
-import reactor.util.annotation.NonNull;
import java.io.IOException;
-import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -25,139 +24,29 @@
import java.util.List;
import java.util.UUID;
-public abstract class BlobOutputStream extends OutputStream {
- /*
- * Holds the write threshold of number of bytes to buffer prior to dispatching a write. For block blob this is the
- * block size, for page blob this is the Page commit size.
- */
- int writeThreshold;
+public abstract class BlobOutputStream extends StorageOutputStream {
- /*
- * Holds the last exception this stream encountered.
- */
- volatile IOException lastError;
+ BlobOutputStream(final int writeThreshold) {
+ super(writeThreshold);
+ }
static BlobOutputStream appendBlobOutputStream(final AppendBlobAsyncClient client,
- final AppendBlobAccessConditions appendBlobAccessConditions) {
+ final AppendBlobAccessConditions appendBlobAccessConditions) {
return new AppendBlobOutputStream(client, appendBlobAccessConditions);
}
static BlobOutputStream blockBlobOutputStream(final BlockBlobAsyncClient client,
- final BlobAccessConditions accessConditions) {
+ final BlobAccessConditions accessConditions) {
return new BlockBlobOutputStream(client, accessConditions);
}
- static BlobOutputStream pageBlobOutputStream(final PageBlobAsyncClient client, final long length,
- final BlobAccessConditions accessConditions) {
- return new PageBlobOutputStream(client, length, accessConditions);
+ static BlobOutputStream pageBlobOutputStream(final PageBlobAsyncClient client, final PageRange pageRange,
+ final BlobAccessConditions accessConditions) {
+ return new PageBlobOutputStream(client, pageRange, accessConditions);
}
- abstract Mono dispatchWrite(byte[] data, int writeLength, long offset);
-
abstract void commit();
- /**
- * Writes the data to the buffer and triggers writes to the service as needed.
- *
- * @param data A byte array which represents the data to write.
- * @param offset An int which represents the start offset in the data.
- * @param length An int which represents the number of bytes to write.
- * @throws IOException If an I/O error occurs. In particular, an IOException may be thrown if the output stream has
- * been closed.
- */
- private void writeInternal(final byte[] data, int offset, int length) {
- int chunks = (int) (Math.ceil((double) length / (double) this.writeThreshold));
- Flux.range(0, chunks).map(c -> offset + c * this.writeThreshold)
- .concatMap(pos -> processChunk(data, pos, offset, length))
- .then()
- .block();
- }
-
- private Mono processChunk(byte[] data, int position, int offset, int length) {
- int chunkLength = this.writeThreshold;
-
- if (position + chunkLength > offset + length) {
- chunkLength = offset + length - position;
- }
-
- // Flux chunkData = new ByteBufferStreamFromByteArray(data, writeThreshold, position, chunkLength);
- return dispatchWrite(data, chunkLength, position - offset)
- .doOnError(t -> {
- if (t instanceof IOException) {
- lastError = (IOException) t;
- } else {
- lastError = new IOException(t);
- }
- });
- }
-
- /**
- * Helper function to check if the stream is faulted, if it is it surfaces the exception.
- *
- * @throws IOException If an I/O error occurs. In particular, an IOException may be thrown if the output stream has
- * been closed.
- */
- private void checkStreamState() throws IOException {
- if (this.lastError != null) {
- throw this.lastError;
- }
- }
-
- /**
- * Flushes this output stream and forces any buffered output bytes to be written out. If any data remains in the
- * buffer it is committed to the service.
- *
- * @throws IOException If an I/O error occurs.
- */
- @Override
- public void flush() throws IOException {
- this.checkStreamState();
- }
-
- /**
- * Writes b.length bytes from the specified byte array to this output stream.
- *
- *
- * @param data A byte array which represents the data to write.
- */
- @Override
- public void write(@NonNull final byte[] data) {
- this.write(data, 0, data.length);
- }
-
- /**
- * Writes length bytes from the specified byte array starting at offset to this output stream.
- *
- *
- * @param data A byte array which represents the data to write.
- * @param offset An int which represents the start offset in the data.
- * @param length An int which represents the number of bytes to write.
- * @throws IndexOutOfBoundsException If {@code offset} or {@code length} are less than {@code 0} or {@code offset}
- * plus {@code length} is greater than the {@code data} length.
- */
- @Override
- public void write(@NonNull final byte[] data, final int offset, final int length) {
- if (offset < 0 || length < 0 || length > data.length - offset) {
- throw new IndexOutOfBoundsException();
- }
-
- this.writeInternal(data, offset, length);
- }
-
- /**
- * Writes the specified byte to this output stream. The general contract for write is that one byte is written to
- * the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits
- * of b are ignored.
- *
- * true is acceptable for you.
- *
- * @param byteVal An int which represents the bye value to write.
- */
- @Override
- public void write(final int byteVal) {
- this.write(new byte[]{(byte) (byteVal & 0xFF)});
- }
-
/**
* Closes this output stream and releases any system resources associated with this stream. If any data remains in
* the buffer it is committed to the service.
@@ -193,9 +82,9 @@ private static final class AppendBlobOutputStream extends BlobOutputStream {
private final AppendBlobAsyncClient client;
private AppendBlobOutputStream(final AppendBlobAsyncClient client,
- final AppendBlobAccessConditions appendBlobAccessConditions) {
+ final AppendBlobAccessConditions appendBlobAccessConditions) {
+ super(AppendBlobClient.MAX_APPEND_BLOCK_BYTES);
this.client = client;
- this.writeThreshold = BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE;
this.appendBlobAccessConditions = appendBlobAccessConditions;
if (appendBlobAccessConditions != null) {
@@ -226,7 +115,7 @@ private Mono appendBlock(Flux blockData, long offset, long wri
}
@Override
- Mono dispatchWrite(byte[] data, int writeLength, long offset) {
+ protected Mono dispatchWrite(byte[] data, int writeLength, long offset) {
if (writeLength == 0) {
return Mono.empty();
}
@@ -244,7 +133,7 @@ Mono dispatchWrite(byte[] data, int writeLength, long offset) {
Flux fbb = Flux.range(0, 1)
.concatMap(pos -> Mono.fromCallable(() -> ByteBuffer.wrap(data, (int) offset, writeLength)));
- return this.appendBlock(fbb.subscribeOn(Schedulers.elastic()), offset, writeLength);
+ return this.appendBlock(fbb.subscribeOn(Schedulers.elastic()), this.initialBlobOffset, writeLength);
}
@Override
@@ -260,11 +149,11 @@ private static final class BlockBlobOutputStream extends BlobOutputStream {
private final BlockBlobAsyncClient client;
private BlockBlobOutputStream(final BlockBlobAsyncClient client, final BlobAccessConditions accessConditions) {
+ super(BlockBlobClient.MAX_STAGE_BLOCK_BYTES);
this.client = client;
this.accessConditions = accessConditions;
this.blockIdPrefix = UUID.randomUUID().toString() + '-';
this.blockList = new ArrayList<>();
- this.writeThreshold = BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE;
}
/**
@@ -291,7 +180,7 @@ private Mono writeBlock(Flux blockData, String blockId, long w
}
@Override
- Mono dispatchWrite(byte[] data, int writeLength, long offset) {
+ protected Mono dispatchWrite(byte[] data, int writeLength, long offset) {
if (writeLength == 0) {
return Mono.empty();
}
@@ -315,13 +204,16 @@ synchronized void commit() {
}
private static final class PageBlobOutputStream extends BlobOutputStream {
+ private final ClientLogger logger = new ClientLogger(PageBlobOutputStream.class);
private final PageBlobAsyncClient client;
private final PageBlobAccessConditions pageBlobAccessConditions;
+ private final PageRange pageRange;
- private PageBlobOutputStream(final PageBlobAsyncClient client, final long length,
- final BlobAccessConditions blobAccessConditions) {
+ private PageBlobOutputStream(final PageBlobAsyncClient client, final PageRange pageRange,
+ final BlobAccessConditions blobAccessConditions) {
+ super(PageBlobClient.MAX_PUT_PAGES_BYTES);
this.client = client;
- this.writeThreshold = (int) Math.min(BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, length);
+ this.pageRange = pageRange;
if (blobAccessConditions != null) {
this.pageBlobAccessConditions = new PageBlobAccessConditions()
@@ -332,8 +224,8 @@ private PageBlobOutputStream(final PageBlobAsyncClient client, final long length
}
}
- private Mono writePages(Flux pageData, long offset, long writeLength) {
- return client.uploadPagesWithResponse(new PageRange().setStart(offset).setEnd(offset + writeLength - 1),
+ private Mono writePages(Flux pageData, int length, long offset) {
+ return client.uploadPagesWithResponse(new PageRange().setStart(offset).setEnd(offset + length - 1),
pageData, pageBlobAccessConditions)
.then()
.onErrorResume(t -> t instanceof StorageException, e -> {
@@ -343,7 +235,7 @@ private Mono writePages(Flux pageData, long offset, long write
}
@Override
- Mono dispatchWrite(byte[] data, int writeLength, long offset) {
+ protected Mono dispatchWrite(byte[] data, int writeLength, long offset) {
if (writeLength == 0) {
return Mono.empty();
}
@@ -356,7 +248,13 @@ Mono dispatchWrite(byte[] data, int writeLength, long offset) {
Flux fbb = Flux.range(0, 1)
.concatMap(pos -> Mono.fromCallable(() -> ByteBuffer.wrap(data, (int) offset, writeLength)));
- return this.writePages(fbb.subscribeOn(Schedulers.elastic()), offset, writeLength);
+ long pageOffset = pageRange.getStart();
+ if (pageOffset + writeLength - 1 > pageRange.getEnd()) {
+ throw logger.logExceptionAsError(
+ new RuntimeException("The input data length is larger than the page range."));
+ }
+ pageRange.setStart(pageRange.getStart() + writeLength);
+ return this.writePages(fbb.subscribeOn(Schedulers.elastic()), writeLength, pageOffset);
}
@Override
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobClient.java
index d66238be568a..d017156fc765 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobClient.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobClient.java
@@ -69,28 +69,30 @@ public final class PageBlobClient extends BlobClientBase {
* Creates and opens an output stream to write data to the page blob. If the blob already exists on the service, it
* will be overwritten.
*
- * @param length A long which represents the length, in bytes, of the stream to create. This value must
- * be a multiple of 512.
+ * @param pageRange A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start
+ * offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges
+ * are 0-511, 512-1023, etc.
* @return A {@link BlobOutputStream} object used to write data to the blob.
* @throws StorageException If a storage service error occurred.
*/
- public BlobOutputStream getBlobOutputStream(long length) {
- return getBlobOutputStream(length, null);
+ public BlobOutputStream getBlobOutputStream(PageRange pageRange) {
+ return getBlobOutputStream(pageRange, null);
}
/**
* Creates and opens an output stream to write data to the page blob. If the blob already exists on the service, it
* will be overwritten.
*
- * @param length A long which represents the length, in bytes, of the stream to create. This value must
- * be a multiple of 512.
+ * @param pageRange A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start
+ * offset must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges
+ * are 0-511, 512-1023, etc.
* @param accessConditions A {@link BlobAccessConditions} object that represents the access conditions for the
* blob.
* @return A {@link BlobOutputStream} object used to write data to the blob.
* @throws StorageException If a storage service error occurred.
*/
- public BlobOutputStream getBlobOutputStream(long length, BlobAccessConditions accessConditions) {
- return BlobOutputStream.pageBlobOutputStream(pageBlobAsyncClient, length, accessConditions);
+ public BlobOutputStream getBlobOutputStream(PageRange pageRange, BlobAccessConditions accessConditions) {
+ return BlobOutputStream.pageBlobOutputStream(pageBlobAsyncClient, pageRange, accessConditions);
}
/**
diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.groovy
index 5e64352115db..6ca80bf94c09 100644
--- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.groovy
+++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.groovy
@@ -1,8 +1,7 @@
package com.azure.storage.blob
-
+import com.azure.storage.blob.models.PageRange
import com.azure.storage.common.Constants
-import spock.lang.Ignore
import spock.lang.Requires
class BlobOutputStreamTest extends APISpec {
@@ -33,7 +32,7 @@ class BlobOutputStreamTest extends APISpec {
when:
- def outputStream = pageBlobClient.getBlobOutputStream(data.length)
+ def outputStream = pageBlobClient.getBlobOutputStream(new PageRange().setStart(0).setEnd(16 * Constants.MB - 1))
outputStream.write(data)
outputStream.close()
@@ -42,7 +41,7 @@ class BlobOutputStreamTest extends APISpec {
}
// Test is failing, need to investigate.
- @Ignore
+ @Requires({ liveMode() })
def "AppendBlob output stream"() {
setup:
def data = getRandomByteArray(4 * FOUR_MB)
@@ -52,7 +51,7 @@ class BlobOutputStreamTest extends APISpec {
when:
def outputStream = appendBlobClient.getBlobOutputStream()
for (int i = 0; i != 4; i++) {
- outputStream.write(Arrays.copyOfRange(data, i * FOUR_MB, ((i + 1) * FOUR_MB) - 1))
+ outputStream.write(Arrays.copyOfRange(data, i * FOUR_MB, ((i + 1) * FOUR_MB)))
}
outputStream.close()
diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobInputOutputStreamTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobInputOutputStreamTest.groovy
index fd9d6a78c964..ded4d9b8b9f2 100644
--- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobInputOutputStreamTest.groovy
+++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobInputOutputStreamTest.groovy
@@ -1,6 +1,6 @@
package com.azure.storage.blob
-
+import com.azure.storage.blob.specialized.BlobOutputStream
import com.azure.storage.blob.specialized.BlockBlobClient
import com.azure.storage.common.Constants
import spock.lang.Requires
@@ -16,11 +16,11 @@ class BlockBlobInputOutputStreamTest extends APISpec {
@Requires({ liveMode() })
def "Upload download"() {
when:
- def length = 30 * Constants.MB
- def randomBytes = getRandomByteArray(length)
+ int length = 6 * Constants.MB
+ byte[] randomBytes = getRandomByteArray(length)
- def outStream = bc.getBlobOutputStream()
- outStream.write(randomBytes)
+ BlobOutputStream outStream = bc.getBlobOutputStream()
+ outStream.write(randomBytes, 1 * Constants.MB, 5 * Constants.MB)
outStream.close()
then:
@@ -34,6 +34,7 @@ class BlockBlobInputOutputStreamTest extends APISpec {
} catch (IOException ex) {
throw new UncheckedIOException(ex)
}
- assert outputStream.toByteArray() == randomBytes
+ byte[] randomBytes2 = outputStream.toByteArray()
+ assert randomBytes2 == Arrays.copyOfRange(randomBytes, 1 * Constants.MB, 6 * Constants.MB)
}
}
diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAPITest.groovy
index 202fedb60c96..f506628933aa 100644
--- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAPITest.groovy
+++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAPITest.groovy
@@ -13,6 +13,7 @@ import com.azure.core.http.policy.HttpPipelinePolicy
import com.azure.core.util.Context
import com.azure.storage.blob.APISpec
import com.azure.storage.blob.BlobAsyncClient
+import com.azure.storage.blob.BlobClient
import com.azure.storage.blob.BlobServiceClientBuilder
import com.azure.storage.blob.models.AccessTier
import com.azure.storage.blob.models.BlobAccessConditions
@@ -42,11 +43,13 @@ class BlockBlobAPITest extends APISpec {
BlockBlobClient bc
BlockBlobAsyncClient bac
BlobAsyncClient blobac
+ BlobClient blobClient
String blobName
def setup() {
blobName = generateBlobName()
- bc = cc.getBlobClient(blobName).getBlockBlobClient()
+ blobClient = cc.getBlobClient(blobName)
+ bc = blobClient.getBlockBlobClient()
bc.upload(defaultInputStream.get(), defaultDataSize)
blobac = ccAsync.getBlobAsyncClient(generateBlobName())
bac = blobac.getBlockBlobAsyncClient()
@@ -602,7 +605,7 @@ class BlockBlobAPITest extends APISpec {
def outStream = new ByteArrayOutputStream()
when:
- bc.uploadFromFile(file.getAbsolutePath())
+ blobClient.uploadFromFile(file.getAbsolutePath())
then:
bc.download(outStream)
@@ -617,7 +620,7 @@ class BlockBlobAPITest extends APISpec {
def outStream = new ByteArrayOutputStream()
when:
- bc.uploadFromFile(file.getAbsolutePath(), null, null, metadata, null, null, null)
+ blobClient.uploadFromFile(file.getAbsolutePath(), null, null, metadata, null, null, null)
then:
metadata == bc.getProperties().getMetadata()
@@ -804,7 +807,7 @@ class BlockBlobAPITest extends APISpec {
def data = getRandomData(dataSize)
ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions()
.setBlockSize(bufferSize).setNumBuffers(numBuffs)
- bac.upload(Flux.just(data), parallelTransferOptions).block()
+ blobac.upload(Flux.just(data), parallelTransferOptions).block()
data.position(0)
then:
@@ -852,7 +855,7 @@ class BlockBlobAPITest extends APISpec {
.setBlockSize(bufferSize).setNumBuffers(numBuffers)
def dataList = [] as List
dataSizeList.each { size -> dataList.add(getRandomData(size)) }
- bac.upload(Flux.fromIterable(dataList), parallelTransferOptions).block()
+ blobac.upload(Flux.fromIterable(dataList), parallelTransferOptions).block()
expect:
compareListToBuffer(dataList, collectBytesInBuffer(bac.download()).block())
@@ -926,7 +929,7 @@ class BlockBlobAPITest extends APISpec {
@Requires({ liveMode() })
def "Buffered upload metadata"() {
setup:
- def metadata = [] as Map
+ def metadata = [:] as Map
if (key1 != null) {
metadata.put(key1, value1)
}
diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/StorageInputStream.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/StorageInputStream.java
new file mode 100644
index 000000000000..1e6bd147fe60
--- /dev/null
+++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/StorageInputStream.java
@@ -0,0 +1,391 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.storage.common;
+
+import com.azure.core.util.logging.ClientLogger;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+
+/**
+ * Provides an input stream to read a given storage resource.
+ */
+public abstract class StorageInputStream extends InputStream {
+ private final ClientLogger logger = new ClientLogger(StorageInputStream.class);
+
+ /**
+ * A flag to determine if the stream is faulted, if so the last error will be thrown on next operation.
+ */
+ protected volatile boolean streamFaulted;
+
+ /**
+ * Holds the last exception this stream encountered.
+ */
+ protected IOException lastError;
+
+
+ /**
+ * Holds the reference to the current buffered data.
+ */
+ private ByteBuffer currentBuffer;
+
+ /**
+ * Holds an absolute byte position for the mark feature.
+ */
+ private long markedPosition;
+
+ /**
+ * Holds the mark delta for which the mark position is expired.
+ */
+ private int markExpiry;
+
+ /**
+ * Holds an absolute byte position of the current read position.
+ */
+ private long currentAbsoluteReadPosition;
+
+ /**
+ * Holds the absolute byte position of the start of the current buffer.
+ */
+ protected long bufferStartOffset;
+
+ /**
+ * Holds the length of the current buffer in bytes.
+ */
+ protected int bufferSize;
+
+ /**
+ * Offset of the source blob this class is configured to stream from.
+ */
+ private final long rangeOffset;
+
+ /**
+ * Holds the stream read size.
+ */
+ private final int chunkSize;
+
+ /**
+ * Holds the stream length.
+ */
+ private final long streamLength;
+
+ /**
+ * Initializes a new instance of the StorageInputStream class.
+ *
+ * @param chunkSize the size of chunk allowed to pass for storage service request.
+ * @param contentLength the actual content length for input data.
+ */
+ protected StorageInputStream(final int chunkSize, final long contentLength) {
+ this(0, null, chunkSize, contentLength);
+ }
+
+ /**
+ * Initializes a new instance of the StorageInputStream class.
+ *
+ * @param rangeOffset The offset of the data to begin stream.
+ * @param rangeLength How much data the stream should return after blobRangeOffset.
+ * @param chunkSize Holds the stream read size.
+ * @param contentLength The length of the stream to be transferred.
+ * @throws IndexOutOfBoundsException when range offset is less than 0 or rangeLength exists but les than or
+ * equal to 0.
+ */
+ protected StorageInputStream(long rangeOffset, final Long rangeLength,
+ final int chunkSize, final long contentLength) {
+ this.rangeOffset = rangeOffset;
+ this.streamFaulted = false;
+ this.currentAbsoluteReadPosition = rangeOffset;
+ this.chunkSize = chunkSize;
+ this.streamLength = rangeLength == null ? contentLength - this.rangeOffset
+ : Math.min(contentLength - this.rangeOffset, rangeLength);
+ if (rangeOffset < 0 || (rangeLength != null && rangeLength <= 0)) {
+ throw logger.logExceptionAsError(new IndexOutOfBoundsException());
+ }
+
+ this.reposition(rangeOffset);
+ }
+
+ /**
+ * Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without
+ * blocking by the next invocation of a method for this input stream. The next invocation might be the same thread
+ * or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes.
+ *
+ * @return An int which represents an estimate of the number of bytes that can be read (or skipped
+ * over) from this input stream without blocking, or 0 when it reaches the end of the input stream.
+ */
+ @Override
+ public synchronized int available() {
+ return this.bufferSize - (int) (this.currentAbsoluteReadPosition - this.bufferStartOffset);
+ }
+
+ /**
+ * Helper function to check if the stream is faulted, if it is it surfaces the exception.
+ *
+ * @throws RuntimeException If an I/O error occurs. In particular, an IOException may be thrown if the output stream
+ * has been closed.
+ */
+ private synchronized void checkStreamState() {
+ if (this.streamFaulted) {
+ throw logger.logExceptionAsError(new RuntimeException(this.lastError.getMessage()));
+ }
+ }
+
+ /**
+ * Closes this input stream and releases any system resources associated with the stream.
+ *
+ * @throws IOException If an I/O error occurs.
+ */
+ @Override
+ public synchronized void close() {
+ this.currentBuffer = null;
+ this.streamFaulted = true;
+ this.lastError = new IOException(SR.STREAM_CLOSED);
+ }
+
+ /**
+ * Dispatches a read operation of N bytes.
+ *
+ * @param readLength An int which represents the number of bytes to read.
+ * @param offset The start point of data to be acquired.
+ * @return The bytebuffer which store one chunk size of data.
+ * @throws IOException If an I/O error occurs.
+ */
+ protected abstract ByteBuffer dispatchRead(int readLength, long offset) throws IOException;
+
+ /**
+ * Marks the current position in this input stream. A subsequent call to the reset method repositions this stream at
+ * the last marked position so that subsequent reads re-read the same bytes.
+ *
+ * @param readlimit An int which represents the maximum limit of bytes that can be read before the mark
+ * position becomes invalid.
+ */
+ @Override
+ public synchronized void mark(final int readlimit) {
+ this.markedPosition = this.currentAbsoluteReadPosition;
+ this.markExpiry = readlimit;
+ }
+
+ /**
+ * Tests if this input stream supports the mark and reset methods. Whether or not mark and reset are supported is an
+ * invariant property of a particular input stream instance. The markSupported method of {@link InputStream} returns
+ * false.
+ *
+ * @return True if this stream instance supports the mark and reset methods; False
+ * otherwise.
+ */
+ @Override
+ public boolean markSupported() {
+ return true;
+ }
+
+ /**
+ * Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If
+ * no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks
+ * until input data is available, the end of the stream is detected, or an exception is thrown.
+ *
+ * @return An int which represents the total number of bytes read into the buffer, or -1 if there is no
+ * more data because the end of the stream has been reached.
+ * @throws RuntimeException when no available bytes to read.
+ * @throws IOException If an I/O error occurs.
+ */
+ @Override
+ public int read() throws IOException {
+ final byte[] tBuff = new byte[1];
+ final int numberOfBytesRead = this.read(tBuff, 0, 1);
+
+ if (numberOfBytesRead > 0) {
+ return tBuff[0] & 0xFF;
+ } else if (numberOfBytesRead == 0) {
+ throw logger.logExceptionAsError(new RuntimeException(SR.UNEXPECTED_STREAM_READ_ERROR));
+ } else {
+ return -1;
+ }
+ }
+
+ /**
+ * Reads some number of bytes from the input stream and stores them into the buffer array b. The number
+ * of bytes actually read is returned as an integer. This method blocks until input data is available, end of file
+ * is detected, or an exception is thrown. If the length of b is zero, then no bytes are read and 0 is
+ * returned; otherwise, there is an attempt to read at least one byte. If no byte is available because the stream is
+ * at the end of the file, the value -1 is returned; otherwise, at least one byte is read and stored into
+ * b.
+ *
+ * The first byte read is stored into element b[0], the next one into b[1], and so on. The
+ * number of bytes read is, at most, equal to the length of b. Let k be the number of
+ * bytes actually read; these bytes will be stored in elements b[0] through b[k-1],
+ * leaving elements b[k] through
+ * b[b.length-1] unaffected.
+ *
+ * The read(b) method for class {@link InputStream} has the same effect as:
+ *
+ * read(b, 0, b.length)
+ *
+ * @param b A byte array which represents the buffer into which the data is read.
+ * @throws IOException If the first byte cannot be read for any reason other than the end of the file, if the input
+ * stream has been closed, or if some other I/O error occurs.
+ * @throws NullPointerException If the byte array b is null.
+ */
+ @Override
+ public int read(final byte[] b) throws IOException {
+ return this.read(b, 0, b.length);
+ }
+
+ /**
+ * Reads up to len bytes of data from the input stream into an array of bytes. An attempt is made to
+ * read as many as len bytes, but a smaller number may be read. The number of bytes actually read is
+ * returned as an integer. This method blocks until input data is available, end of file is detected, or an
+ * exception is thrown.
+ *
+ * If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at
+ * least one byte. If no byte is available because the stream is at end of file, the value -1 is returned;
+ * otherwise, at least one byte is read and stored into b.
+ *
+ * The first byte read is stored into element b[off], the next one into b[off+1], and so
+ * on. The number of bytes read is, at most, equal to len. Let k be the number of bytes
+ * actually read; these bytes will be stored in elements b[off] through b[off+k-1],
+ * leaving elements b[off+k] through
+ * b[off+len-1] unaffected.
+ *
+ * In every case, elements b[0] through b[off] and elements b[off+len]
+ * through b[b.length-1] are unaffected.
+ *
+ * The read(b, off, len) method for class {@link InputStream} simply calls the method
+ * read() repeatedly. If the first such
+ * call results in an IOException, that exception is returned from the call to the
+ * read(b, off, len) method. If any
+ * subsequent call to read() results in a IOException, the exception is caught and treated
+ * as if it were end of file; the bytes read up to that point are stored into b and the number of bytes
+ * read before the exception occurred is returned. The default implementation of this method blocks until the
+ * requested amount of input data
+ * len has been read, end of file is detected, or an exception is thrown. Subclasses are encouraged to
+ * provide a more efficient implementation of this method.
+ *
+ * @param b A byte array which represents the buffer into which the data is read.
+ * @param off An int which represents the start offset in the byte array at which the data
+ * is written.
+ * @param len An int which represents the maximum number of bytes to read.
+ * @return An int which represents the total number of bytes read into the buffer, or -1 if there is no
+ * more data because the end of the stream has been reached.
+ * @throws IOException If the first byte cannot be read for any reason other than end of file, or if the input
+ * stream has been closed, or if some other I/O error occurs.
+ * @throws NullPointerException If the byte array b is null.
+ * @throws IndexOutOfBoundsException If off is negative, len is negative, or
+ * len is greater than
+ * b.length - off.
+ */
+ @Override
+ public int read(final byte[] b, final int off, final int len) throws IOException {
+ if (off < 0 || len < 0 || len > b.length - off) {
+ throw logger.logExceptionAsError(new IndexOutOfBoundsException());
+ }
+
+ int chunks = (int) (Math.ceil((double) len / (double) this.chunkSize));
+ int numOfBytesRead = 0;
+ for (int i = 0; i < chunks; i++) {
+ int results = this.readInternal(b, off + numOfBytesRead, len);
+ if (results == -1) {
+ return -1;
+ }
+ numOfBytesRead += results;
+ }
+ return numOfBytesRead;
+ }
+
+ /**
+ * Performs internal read to the given byte buffer.
+ *
+ * @param b A byte array which represents the buffer into which the data is read.
+ * @param off An int which represents the start offset in the byte array b at
+ * which the data is written.
+ * @param len An int which represents the maximum number of bytes to read.
+ * @return An int which represents the total number of bytes read into the buffer, or -1 if there is no
+ * more data because the end of the stream has been reached.
+ * @throws IOException If the first byte cannot be read for any reason other than end of file, or if the input
+ * stream has been closed, or if some other I/O error occurs.
+ */
+ private synchronized int readInternal(final byte[] b, final int off, int len) throws IOException {
+ this.checkStreamState();
+
+ // if buffer is empty do next get operation
+ if ((this.currentBuffer == null || this.currentBuffer.remaining() == 0)
+ && this.currentAbsoluteReadPosition < this.streamLength + this.rangeOffset) {
+ this.currentBuffer = this.dispatchRead((int) Math.min(this.chunkSize,
+ this.streamLength + this.rangeOffset - this.currentAbsoluteReadPosition),
+ this.currentAbsoluteReadPosition);
+ }
+
+ len = Math.min(len, this.chunkSize);
+
+ final int numberOfBytesRead;
+ if (currentBuffer.remaining() == 0) {
+ numberOfBytesRead = -1;
+ } else {
+ numberOfBytesRead = Math.min(len, this.currentBuffer.remaining());
+ // do read from buffer
+ this.currentBuffer = this.currentBuffer.get(b, off, numberOfBytesRead);
+ }
+
+ if (numberOfBytesRead > 0) {
+ this.currentAbsoluteReadPosition += numberOfBytesRead;
+ }
+
+ // update markers
+ if (this.markExpiry > 0 && this.markedPosition + this.markExpiry < this.currentAbsoluteReadPosition) {
+ this.markedPosition = this.rangeOffset;
+ this.markExpiry = 0;
+ }
+
+ return numberOfBytesRead;
+ }
+
+ /**
+ * Repositions the stream to the given absolute byte offset.
+ *
+ * @param absolutePosition A long which represents the absolute byte offset withitn the stream
+ * reposition.
+ */
+ private synchronized void reposition(final long absolutePosition) {
+ this.currentAbsoluteReadPosition = absolutePosition;
+ this.currentBuffer = ByteBuffer.allocate(0);
+ this.bufferStartOffset = absolutePosition;
+ }
+
+ /**
+ * Repositions this stream to the position at the time the mark method was last called on this input stream. Note
+ * repositioning the blob read stream will disable blob MD5 checking.
+ *
+ * @throws RuntimeException If this stream has not been marked or if the mark has been invalidated.
+ */
+ @Override
+ public synchronized void reset() {
+ if (this.markedPosition + this.markExpiry < this.currentAbsoluteReadPosition) {
+ throw logger.logExceptionAsError(new RuntimeException(SR.MARK_EXPIRED));
+ }
+ this.reposition(this.markedPosition);
+ }
+
+ /**
+ * Skips over and discards n bytes of data from this input stream. The skip method may, for a variety of reasons,
+ * end up skipping over some smaller number of bytes, possibly 0. This may result from any of a number of
+ * conditions; reaching end of file before n bytes have been skipped is only one possibility. The actual number of
+ * bytes skipped is returned. If n is negative, no bytes are skipped.
+ *
+ * Note repositioning the blob read stream will disable blob MD5 checking.
+ *
+ * @param n A long which represents the number of bytes to skip.
+ */
+ @Override
+ public synchronized long skip(final long n) {
+ if (n == 0) {
+ return 0;
+ }
+
+ if (n < 0 || this.currentAbsoluteReadPosition + n > this.streamLength + this.rangeOffset) {
+ throw logger.logExceptionAsError(new IndexOutOfBoundsException());
+ }
+
+ this.reposition(this.currentAbsoluteReadPosition + n);
+ return n;
+ }
+}
diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/StorageOutputStream.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/StorageOutputStream.java
new file mode 100644
index 000000000000..8ca6af592473
--- /dev/null
+++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/StorageOutputStream.java
@@ -0,0 +1,155 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.storage.common;
+
+import com.azure.core.util.logging.ClientLogger;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+import reactor.util.annotation.NonNull;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * StorageOutputStream
+ */
+public abstract class StorageOutputStream extends OutputStream {
+ final ClientLogger logger = new ClientLogger(StorageOutputStream.class);
+
+ /*
+ * Holds the write threshold of number of bytes to buffer prior to dispatching a write. For block blob this is the
+ * block size, for page blob this is the Page commit size.
+ */
+ private final int writeThreshold;
+
+ /*
+ * Holds the last exception this stream encountered.
+ */
+ protected volatile IOException lastError;
+
+ protected abstract Mono dispatchWrite(byte[] data, int writeLength, long offset);
+
+ protected StorageOutputStream(final int writeThreshold) {
+ this.writeThreshold = writeThreshold;
+ }
+
+ /**
+ * Writes the data to the buffer and triggers writes to the service as needed.
+ *
+ * @param data A byte array which represents the data to write.
+ * @param offset An int which represents the start offset in the data.
+ * @param length An int which represents the number of bytes to write.
+ */
+ private void writeInternal(final byte[] data, int offset, int length) {
+ int chunks = (int) (Math.ceil((double) length / (double) this.writeThreshold));
+ Flux.range(0, chunks).map(c -> offset + c * this.writeThreshold)
+ .concatMap(pos -> processChunk(data, pos, offset, length))
+ .then()
+ .block();
+ }
+
+ private Mono processChunk(byte[] data, int position, int offset, int length) {
+ int chunkLength = this.writeThreshold;
+
+ if (position + chunkLength > offset + length) {
+ chunkLength = offset + length - position;
+ }
+
+ // Flux chunkData = new ByteBufferStreamFromByteArray(data, writeThreshold, position, chunkLength);
+ return dispatchWrite(data, chunkLength, position)
+ .doOnError(t -> {
+ if (t instanceof IOException) {
+ lastError = (IOException) t;
+ } else {
+ lastError = new IOException(t);
+ }
+ });
+ }
+
+ /**
+ * Helper function to check if the stream is faulted, if it is it surfaces the exception.
+ *
+ * @throws RuntimeException If an I/O error occurs. In particular, an IOException may be thrown
+ * if the output stream has been closed.
+ */
+ protected void checkStreamState() {
+ if (this.lastError != null) {
+ throw logger.logExceptionAsError(new RuntimeException(this.lastError.getMessage()));
+ }
+ }
+
+ /**
+ * Flushes this output stream and forces any buffered output bytes to be written out. If any data remains in the
+ * buffer it is committed to the service.
+ */
+ @Override
+ public void flush() {
+ this.checkStreamState();
+ }
+
+ /**
+ * Writes b.length bytes from the specified byte array to this output stream.
+ *
+ *
+ * @param data A byte array which represents the data to write.
+ */
+ @Override
+ public void write(@NonNull final byte[] data) {
+ this.write(data, 0, data.length);
+ }
+
+ /**
+ * Writes length bytes from the specified byte array starting at offset to this output stream.
+ *
+ *
+ * @param data A byte array which represents the data to write.
+ * @param offset An int which represents the start offset in the data.
+ * @param length An int which represents the number of bytes to write.
+ * @throws IndexOutOfBoundsException when access the bytes out of the bound.
+ */
+ @Override
+ public void write(@NonNull final byte[] data, final int offset, final int length) {
+ if (offset < 0 || length < 0 || length > data.length - offset) {
+ throw logger.logExceptionAsError(new IndexOutOfBoundsException());
+ }
+
+ this.writeInternal(data, offset, length);
+ }
+
+ /**
+ * Writes the specified byte to this output stream. The general contract for write is that one byte is written to
+ * the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits
+ * of b are ignored.
+ *
+ * true is acceptable for you.
+ *
+ * @param byteVal An int which represents the bye value to write.
+ */
+ @Override
+ public void write(final int byteVal) {
+ this.write(new byte[]{(byte) (byteVal & 0xFF)});
+ }
+
+ /**
+ * Closes this output stream and releases any system resources associated with this stream. If any data remains in
+ * the buffer it is committed to the service.
+ *
+ * @throws IOException If an I/O error occurs.
+ */
+ @Override
+ public synchronized void close() throws IOException {
+ try {
+ // if the user has already closed the stream, this will throw a STREAM_CLOSED exception
+ // if an exception was thrown by any thread in the threadExecutor, realize it now
+ this.checkStreamState();
+
+ // flush any remaining data
+ this.flush();
+ } finally {
+ // if close() is called again, an exception will be thrown
+ this.lastError = new IOException(SR.STREAM_CLOSED);
+ }
+ }
+
+}
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java
index 082857cf1893..65facb96362c 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java
@@ -48,7 +48,7 @@ public class FileClient {
private final FileAsyncClient fileAsyncClient;
/**
- * Creates a FileClient that wraps a FileAsyncClient and blocks requests.
+ * Creates a FileClient that wraps a FileAsyncClient and requests.
*
* @param fileAsyncClient FileAsyncClient that is used to send requests
*/
@@ -65,6 +65,53 @@ public String getFileUrl() {
return fileAsyncClient.getFileUrl();
}
+ /**
+ * Opens a file input stream to download the file.
+ *
+ *
+ * @return An InputStream object that represents the stream to use for reading from the file.
+ * @throws StorageException If a storage service error occurred.
+ */
+ public final StorageFileInputStream openInputStream() {
+ return openInputStream(new FileRange(0));
+ }
+
+ /**
+ * Opens a file input stream to download the specified range of the file.
+ *
+ *
+ * @param range {@link FileRange}
+ * @return An InputStream object that represents the stream to use for reading from the file.
+ * @throws StorageException If a storage service error occurred.
+ */
+ public final StorageFileInputStream openInputStream(FileRange range) {
+ return new StorageFileInputStream(fileAsyncClient, range.getStart(), range.getEnd());
+ }
+
+ /**
+ * Creates and opens an output stream to write data to the file. If the file already exists on the service, it
+ * will be overwritten.
+ *
+ * @return A {@link StorageFileOutputStream} object used to write data to the file.
+ * @throws StorageException If a storage service error occurred.
+ */
+ public final StorageFileOutputStream getFileOutputStream() {
+ return getFileOutputStream(0);
+ }
+
+ /**
+ * Creates and opens an output stream to write data to the file. If the file already exists on the service, it
+ * will be overwritten.
+ *
+ * @param offset Optional starting point of the upload range. It will start from the beginning if it is
+ * {@code null}
+ * @return A {@link StorageFileOutputStream} object used to write data to the file.
+ * @throws StorageException If a storage service error occurred.
+ */
+ public final StorageFileOutputStream getFileOutputStream(long offset) {
+ return new StorageFileOutputStream(fileAsyncClient, offset);
+ }
+
/**
* Creates a file in the storage account and returns a response of {@link FileInfo} to interact with it.
*
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/StorageFileInputStream.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/StorageFileInputStream.java
new file mode 100644
index 000000000000..8e7138119692
--- /dev/null
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/StorageFileInputStream.java
@@ -0,0 +1,74 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.storage.file;
+
+import com.azure.core.implementation.util.FluxUtil;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.storage.common.Constants;
+import com.azure.storage.common.StorageInputStream;
+import com.azure.storage.file.models.FileRange;
+import com.azure.storage.file.models.StorageException;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/**
+ * Provides an input stream to read a given storage file resource.
+ */
+public class StorageFileInputStream extends StorageInputStream {
+ final ClientLogger logger = new ClientLogger(StorageFileInputStream.class);
+
+ private final FileAsyncClient fileAsyncClient;
+
+ /**
+ * Initializes a new instance of the StorageFileInputStream class.
+ *
+ * @param fileAsyncClient A {@link FileClient} object which represents the blob that this stream is associated with.
+ * @throws StorageException An exception representing any error which occurred during the operation.
+ */
+ StorageFileInputStream(final FileAsyncClient fileAsyncClient)
+ throws StorageException {
+ this(fileAsyncClient, 0, null);
+ }
+
+ /**
+ * Initializes a new instance of the StorageFileInputStream class. Note that if {@code fileRangeOffset} is not
+ * {@code 0} or {@code fileRangeLength} is not {@code null}, there will be no content MD5 verification.
+ *
+ * @param fileAsyncClient A {@link FileAsyncClient} object which represents the blob
+ * that this stream is associated with.
+ * @param fileRangeOffset The offset of file range data to begin stream.
+ * @param fileRangeLength How much data the stream should return after fileRangeOffset.
+ * @throws StorageException An exception representing any error which occurred during the operation.
+ */
+ StorageFileInputStream(final FileAsyncClient fileAsyncClient, long fileRangeOffset, Long fileRangeLength)
+ throws StorageException {
+ super(fileRangeOffset, fileRangeLength, 4 * Constants.MB,
+ fileAsyncClient.getProperties().block().getContentLength());
+ this.fileAsyncClient = fileAsyncClient;
+ }
+
+ /**
+ * Dispatches a read operation of N bytes.
+ *
+ * @param readLength An int which represents the number of bytes to read.
+ */
+ @Override
+ protected synchronized ByteBuffer dispatchRead(final int readLength, final long offset) {
+ try {
+ ByteBuffer currentBuffer = this.fileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(offset,
+ offset + readLength - 1), false)
+ .flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.getValue().getBody())
+ .map(ByteBuffer::wrap))
+ .block();
+
+ this.bufferSize = readLength;
+ this.bufferStartOffset = offset;
+ return currentBuffer;
+ } catch (final StorageException e) {
+ this.streamFaulted = true;
+ this.lastError = new IOException(e);
+ throw logger.logExceptionAsError(new RuntimeException(this.lastError.getMessage()));
+ }
+ }
+}
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/StorageFileOutputStream.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/StorageFileOutputStream.java
new file mode 100644
index 000000000000..9dcf9706e30e
--- /dev/null
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/StorageFileOutputStream.java
@@ -0,0 +1,49 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.storage.file;
+
+import com.azure.storage.common.Constants;
+import com.azure.storage.common.StorageOutputStream;
+import com.azure.storage.file.models.StorageException;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
+
+public class StorageFileOutputStream extends StorageOutputStream {
+ private long offsetPos;
+
+ private final FileAsyncClient client;
+
+ StorageFileOutputStream(final FileAsyncClient client, long offsetPos) {
+ super(4 * Constants.MB);
+ this.client = client;
+ this.offsetPos = offsetPos;
+ }
+
+ private Mono uploadData(Flux inputData, long writeLength, long offset) {
+ return client.uploadWithResponse(inputData, writeLength, offset)
+ .then()
+ .onErrorResume(t -> t instanceof IOException || t instanceof StorageException, e -> {
+ this.lastError = new IOException(e);
+ return null;
+ });
+ }
+
+ @Override
+ protected Mono dispatchWrite(byte[] data, int writeLength, long offset) {
+ if (writeLength == 0) {
+ return Mono.empty();
+ }
+
+ Flux fbb = Flux.range(0, 1)
+ .concatMap(pos -> Mono.fromCallable(() -> ByteBuffer.wrap(data, (int) offset, writeLength)));
+
+ long fileOffset = this.offsetPos;
+ this.offsetPos = this.offsetPos + writeLength;
+
+ return this.uploadData(fbb.subscribeOn(Schedulers.elastic()), writeLength, fileOffset);
+ }
+}
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRange.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRange.java
index 4d8fa259796a..9d60485acf3c 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRange.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/models/FileRange.java
@@ -3,22 +3,44 @@
package com.azure.storage.file.models;
-import java.util.Objects;
+import com.azure.core.util.logging.ClientLogger;
+import java.util.Locale;
/**
* The range of a file in the storage file service.
*/
public final class FileRange {
+ final ClientLogger logger = new ClientLogger(FileRange.class);
+ private static final String RANGE_HEADER_FORMAT = "bytes=%d-%d";
+ private static final String BEGIN_RANGE_HEADER_FORMAT = "bytes=%d-";
private final long start;
private final Long end;
+ /**
+ * Create an instance of the range of a file. Specify the start the range
+ * and the end defaults to the length of the file.
+ * @param start Specifies the start of bytes to be written.
+ */
+ public FileRange(final long start) {
+ this(start, null);
+ }
+
/**
* Create an instance of the range of a file. Both the start and end of the range must be specified.
* @param start Specifies the start of bytes to be written.
* @param end Specifies the end of bytes to be written
*/
public FileRange(final long start, final Long end) {
+ if (start < 0) {
+ throw logger.logExceptionAsError(new IllegalArgumentException(
+ "FileRange offset must be greater than or equal to 0."));
+ }
this.start = start;
+
+ if (end != null && end < 0) {
+ throw logger.logExceptionAsError(new IllegalArgumentException(new IllegalArgumentException(
+ "FileRange end must be greater than or equal to 0 if specified.")));
+ }
this.end = end;
}
@@ -51,7 +73,22 @@ public Long getEnd() {
*/
@Override
public String toString() {
- String endString = Objects.toString(end);
- return "bytes=" + String.valueOf(start) + "-" + endString;
+ if (this.end != null) {
+ return String.format(Locale.ROOT, RANGE_HEADER_FORMAT, this.start, this.end);
+ }
+
+ return String.format(Locale.ROOT, BEGIN_RANGE_HEADER_FORMAT, this.start);
+ }
+
+ /**
+ * @return {@link FileRange#toString()} if {@code count} isn't {@code null} or {@code offset} isn't 0, otherwise
+ * null.
+ */
+ public String toHeaderValue() {
+ // The default values of a BlobRange
+ if (this.start == 0 && this.end == null) {
+ return null;
+ }
+ return this.toString();
}
}
diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/APISpec.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/APISpec.groovy
index 9f7ef550b3aa..0707a8630f06 100644
--- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/APISpec.groovy
+++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/APISpec.groovy
@@ -18,6 +18,7 @@ import com.azure.storage.file.FileServiceClient
import com.azure.storage.file.FileServiceClientBuilder
import com.azure.storage.file.ShareClientBuilder
import com.azure.storage.file.models.ListSharesOptions
+import spock.lang.Shared
import spock.lang.Specification
import java.time.Duration
@@ -25,8 +26,8 @@ import java.time.OffsetDateTime
class APISpec extends Specification {
// Field common used for all APIs.
- def logger = new ClientLogger(APISpec.class)
- def AZURE_TEST_MODE = "AZURE_TEST_MODE"
+ static ClientLogger logger = new ClientLogger(APISpec.class)
+ static def AZURE_TEST_MODE = "AZURE_TEST_MODE"
def tmpFolder = getClass().getClassLoader().getResource("tmptestfiles")
def testFolder = getClass().getClassLoader().getResource("testfiles")
InterceptorManager interceptorManager
@@ -39,7 +40,8 @@ class APISpec extends Specification {
// Test name for test method name.
def methodName
- def testMode = getTestMode()
+
+ static def testMode = getTestMode()
String connectionString
// If debugging is enabled, recordings cannot run as there can only be one proxy at a time.
@@ -89,7 +91,7 @@ class APISpec extends Specification {
* - Playback: (default if no test mode setup)
*
*/
- def getTestMode() {
+ static def getTestMode() {
def azureTestMode = Configuration.getGlobalConfiguration().get(AZURE_TEST_MODE)
if (azureTestMode != null) {
@@ -105,6 +107,10 @@ class APISpec extends Specification {
return TestMode.PLAYBACK
}
+ static boolean liveMode() {
+ return testMode == TestMode.RECORD
+ }
+
def fileServiceBuilderHelper(final InterceptorManager interceptorManager) {
if (testMode == TestMode.RECORD) {
return new FileServiceClientBuilder()
diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/StorageFileInputOutputStreamTests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/StorageFileInputOutputStreamTests.groovy
new file mode 100644
index 000000000000..40d02762f721
--- /dev/null
+++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/StorageFileInputOutputStreamTests.groovy
@@ -0,0 +1,77 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.storage.file
+
+import com.azure.storage.common.Constants
+import com.azure.storage.file.APISpec
+import com.azure.storage.file.FileTestHelper
+import com.azure.storage.file.StorageFileInputStream
+import com.azure.storage.file.StorageFileOutputStream
+import spock.lang.Requires
+
+class StorageFileInputOutputStreamTests extends APISpec {
+ def fileClient
+ int length
+
+ def setup() {
+ def shareName = testResourceName.randomName(methodName, 60)
+ def filePath = testResourceName.randomName(methodName, 60)
+ def shareClient = shareBuilderHelper(interceptorManager, shareName).buildClient()
+ shareClient.create()
+ fileClient = shareClient.getFileClient(filePath)
+ }
+
+ @Requires({ APISpec.liveMode() })
+ def "Upload download"() {
+ when:
+ length = 30 * Constants.MB
+ fileClient.create(length)
+ byte[] randomBytes = FileTestHelper.getRandomBuffer(length)
+
+ StorageFileOutputStream outStream = fileClient.getFileOutputStream()
+ outStream.write(randomBytes)
+ outStream.close()
+
+ then:
+ StorageFileInputStream inputStream = fileClient.openInputStream()
+ int b
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream()
+ try {
+ while ((b = inputStream.read()) != -1){
+ outputStream.write(b)
+ }
+ } catch (IOException ex) {
+ throw new UncheckedIOException(ex)
+ }
+ byte[] randomBytes2 = outputStream.toByteArray()
+ assert randomBytes2 == randomBytes
+ }
+
+
+ @Requires({ APISpec.liveMode() })
+ def "Stream with offset"() {
+ when:
+ length = 7 * Constants.MB
+ fileClient.create(length)
+ byte[] randomBytes = FileTestHelper.getRandomBuffer(9 * Constants.MB)
+
+ StorageFileOutputStream outStream = fileClient.getFileOutputStream()
+ outStream.write(randomBytes, 2 * Constants.MB, length)
+ outStream.close()
+
+ then:
+ StorageFileInputStream inputStream = fileClient.openInputStream()
+ byte[] b = new byte[length]
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream()
+ try {
+ if(inputStream.read(b) != -1){
+ outputStream.write(b, 0, b.length)
+ }
+ } catch (IOException ex) {
+ throw new UncheckedIOException(ex)
+ }
+ byte[] randomBytes2 = outputStream.toByteArray()
+ assert randomBytes2 == Arrays.copyOfRange(randomBytes, 2 * Constants.MB, 9 * Constants.MB)
+ }
+}
diff --git a/sdk/storage/azure-storage-file/src/test/resources/session-records/StorageFileInputOutputStreamTestsStreamOverLimits.json b/sdk/storage/azure-storage-file/src/test/resources/session-records/StorageFileInputOutputStreamTestsStreamOverLimits.json
new file mode 100644
index 000000000000..da192c8dc5d2
--- /dev/null
+++ b/sdk/storage/azure-storage-file/src/test/resources/session-records/StorageFileInputOutputStreamTestsStreamOverLimits.json
@@ -0,0 +1,54 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "PUT",
+ "Uri" : "https://sima.file.core.windows.net/storagefileinputoutputstreamtestsstreamoverlimits65105a0a?restype=share",
+ "Headers" : {
+ "x-ms-version" : "2019-02-02",
+ "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.4 1.8.0_221; Windows 10 10.0",
+ "x-ms-client-request-id" : "025c4120-d52b-45db-a7ec-a71b701364ad"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "\"0x8D74071C73C5E31\"",
+ "Last-Modified" : "Mon, 23 Sep 2019 22:02:51 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "34bf2060-901a-0065-6d5a-727ecf000000",
+ "Date" : "Mon, 23 Sep 2019 22:02:50 GMT",
+ "x-ms-client-request-id" : "025c4120-d52b-45db-a7ec-a71b701364ad"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "https://sima.file.core.windows.net/storagefileinputoutputstreamtestsstreamoverlimits65105a0a/storagefileinputoutputstreamtestsstreamoverlimits4065214f",
+ "Headers" : {
+ "x-ms-version" : "2019-02-02",
+ "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.4 1.8.0_221; Windows 10 10.0",
+ "x-ms-client-request-id" : "89995268-fd27-491b-8483-6f2119f1d302"
+ },
+ "Response" : {
+ "x-ms-version" : "2019-02-02",
+ "x-ms-file-permission-key" : "9147088710610530974*15442866184092965392",
+ "x-ms-file-id" : "13835128424026341376",
+ "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0",
+ "x-ms-file-creation-time" : "2019-09-23T22:02:52.0255146Z",
+ "Last-Modified" : "Mon, 23 Sep 2019 22:02:52 GMT",
+ "retry-after" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-server-encrypted" : "true",
+ "Date" : "Mon, 23 Sep 2019 22:02:51 GMT",
+ "ETag" : "\"0x8D74071C796F2AA\"",
+ "x-ms-file-attributes" : "Archive",
+ "x-ms-file-change-time" : "2019-09-23T22:02:52.0255146Z",
+ "x-ms-file-parent-id" : "0",
+ "Content-Length" : "0",
+ "x-ms-request-id" : "34bf2063-901a-0065-6e5a-727ecf000000",
+ "x-ms-client-request-id" : "89995268-fd27-491b-8483-6f2119f1d302",
+ "x-ms-file-last-write-time" : "2019-09-23T22:02:52.0255146Z"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ "storagefileinputoutputstreamtestsstreamoverlimits65105a0a", "storagefileinputoutputstreamtestsstreamoverlimits4065214f" ]
+}
\ No newline at end of file
From d7b3d91f92c3ee66e763e2bd348c722620c85f0a Mon Sep 17 00:00:00 2001
From: Srikanta <51379715+srnagar@users.noreply.github.com>
Date: Fri, 4 Oct 2019 15:13:44 -0700
Subject: [PATCH 14/18] Renaming classes and methods as per naming guidelines
(#5691)
* Renaming classes and methods as per naming guidelines
---
.../resources/spotbugs/spotbugs-exclude.xml | 2 +-
.../blob/BlobPartitionManagerSample.java | 1 -
...ntProcessorBlobPartitionManagerSample.java | 3 +-
.../azure/storage/blob/BlobClientBuilder.java | 2 +-
.../blob/BlobContainerAsyncClient.java | 13 +-
.../storage/blob/BlobContainerClient.java | 3 +-
.../blob/BlobContainerClientBuilder.java | 3 +-
.../storage/blob/BlobServiceAsyncClient.java | 9 +-
.../azure/storage/blob/BlobServiceClient.java | 3 +-
.../blob/BlobServiceClientBuilder.java | 3 +-
.../{BlobURLParts.java => BlobUrlParts.java} | 52 +++----
...TTPGetterInfo.java => HttpGetterInfo.java} | 16 +--
.../blob/specialized/BlobAsyncClientBase.java | 23 ++-
.../blob/specialized/BlobClientBase.java | 3 +-
.../BlobServiceSasQueryParameters.java | 36 ++---
.../BlobServiceSasSignatureValues.java | 18 +--
.../specialized/DownloadAsyncResponse.java | 8 +-
.../SpecializedBlobClientBuilder.java | 4 +-
.../BlobAsyncClientJavaDocCodeSnippets.java | 3 +-
.../blob/BlobClientJavaDocCodeSnippets.java | 1 -
...ntainerAsyncClientJavaDocCodeSnippets.java | 1 -
...lobContainerClientJavaDocCodeSnippets.java | 3 +-
.../BlobServiceClientJavaDocCodeSnippets.java | 1 -
...lobAsyncClientBaseJavaDocCodeSnippets.java | 1 -
.../BlobClientBaseJavaDocCodeSnippets.java | 1 -
.../com/azure/storage/blob/APISpec.groovy | 2 +-
.../com/azure/storage/blob/BlobAPITest.groovy | 8 +-
.../com/azure/storage/blob/CPKTest.groovy | 6 +-
.../com/azure/storage/blob/SASTest.groovy | 132 +++++++++---------
.../specialized/DownloadResponseMockFlux.java | 6 +-
.../specialized/DownloadResponseTest.groovy | 18 +--
.../blob/specialized/HelperTest.groovy | 71 +++++-----
...mission.java => AccountSasPermission.java} | 48 +++----
.../common/AccountSasQueryParameters.java | 8 +-
...eType.java => AccountSasResourceType.java} | 30 ++--
...SASService.java => AccountSasService.java} | 32 ++---
...es.java => AccountSasSignatureValues.java} | 82 +++++------
.../common/BaseSasQueryParameters.java | 10 +-
.../{SASProtocol.java => SasProtocol.java} | 14 +-
.../credentials/SasTokenCredential.java | 2 +-
...SASTokenCredentialJavaDocCodeSnippets.java | 44 ++++++
.../azure/storage/file/FileAsyncClient.java | 17 ++-
.../com/azure/storage/file/FileClient.java | 5 +-
.../storage/file/FileServiceAsyncClient.java | 9 +-
.../azure/storage/file/FileServiceClient.java | 3 +-
.../file/FileServiceSasQueryParameters.java | 4 +-
.../file/FileServiceSasSignatureValues.java | 14 +-
.../azure/storage/file/ShareAsyncClient.java | 9 +-
.../com/azure/storage/file/ShareClient.java | 3 +-
.../DirectoryAsyncJavaDocCodeSamples.java | 1 -
.../file/FileAsyncJavaDocCodeSamples.java | 3 +-
.../storage/file/FileJavaDocCodeSamples.java | 1 -
.../FileServiceAsyncJavaDocCodeSamples.java | 1 -
.../file/FileServiceJavaDocCodeSamples.java | 1 -
.../file/ShareAsyncJavaDocCodeSamples.java | 1 -
.../storage/file/ShareJavaDocCodeSamples.java | 1 -
.../azure/storage/file/FileSASTests.groovy | 23 +--
.../azure/storage/queue/QueueAsyncClient.java | 9 +-
.../com/azure/storage/queue/QueueClient.java | 3 +-
.../queue/QueueServiceAsyncClient.java | 9 +-
.../storage/queue/QueueServiceClient.java | 3 +-
.../queue/QueueServiceSasQueryParameters.java | 4 +-
.../queue/QueueServiceSasSignatureValues.java | 14 +-
.../queue/QueueAsyncJavaDocCodeSamples.java | 1 -
.../queue/QueueJavaDocCodeSamples.java | 1 -
.../QueueServiceAsyncJavaDocCodeSamples.java | 1 -
.../queue/QueueServiceJavaDocCodeSamples.java | 1 -
.../azure/storage/queue/QueueSASTests.groovy | 32 +++--
68 files changed, 453 insertions(+), 447 deletions(-)
rename sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/{BlobURLParts.java => BlobUrlParts.java} (88%)
rename sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/{HTTPGetterInfo.java => HttpGetterInfo.java} (85%)
rename sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/{AccountSASPermission.java => AccountSasPermission.java} (83%)
rename sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/{AccountSASResourceType.java => AccountSasResourceType.java} (82%)
rename sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/{AccountSASService.java => AccountSasService.java} (82%)
rename sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/{AccountSASSignatureValues.java => AccountSasSignatureValues.java} (77%)
rename sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/{SASProtocol.java => SasProtocol.java} (77%)
create mode 100644 sdk/storage/azure-storage-common/src/samples/java/com/azure/storage/common/credentials/SASTokenCredentialJavaDocCodeSnippets.java
diff --git a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml
index 7974e0546cd5..cc252d33809f 100755
--- a/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml
+++ b/eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml
@@ -383,7 +383,7 @@
-
+
diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobPartitionManagerSample.java b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobPartitionManagerSample.java
index 885fd7e68923..1599ca727957 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobPartitionManagerSample.java
+++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobPartitionManagerSample.java
@@ -8,7 +8,6 @@
import com.azure.messaging.eventhubs.models.PartitionOwnership;
import com.azure.storage.blob.BlobContainerAsyncClient;
import com.azure.storage.blob.BlobContainerClientBuilder;
-
import java.util.StringJoiner;
/**
diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/EventProcessorBlobPartitionManagerSample.java b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/EventProcessorBlobPartitionManagerSample.java
index 76ddcc304b52..1b1159219b5d 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/EventProcessorBlobPartitionManagerSample.java
+++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/EventProcessorBlobPartitionManagerSample.java
@@ -13,9 +13,8 @@
import com.azure.messaging.eventhubs.models.PartitionContext;
import com.azure.storage.blob.BlobContainerAsyncClient;
import com.azure.storage.blob.BlobContainerClientBuilder;
-import reactor.core.publisher.Mono;
-
import java.util.concurrent.TimeUnit;
+import reactor.core.publisher.Mono;
/**
* Sample for using {@link BlobPartitionManager} with {@link EventProcessor}.
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java
index 953d7ad5b2c7..af4edef307bb 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java
@@ -104,7 +104,7 @@ public BlobAsyncClient buildAsyncClient() {
public BlobClientBuilder endpoint(String endpoint) {
try {
URL url = new URL(endpoint);
- BlobURLParts parts = BlobURLParts.parse(url);
+ BlobUrlParts parts = BlobUrlParts.parse(url);
this.endpoint = parts.getScheme() + "://" + parts.getHost();
this.containerName = parts.getBlobContainerName();
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 57e4f698d7cb..e7ddc5e8425a 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
@@ -3,6 +3,9 @@
package com.azure.storage.blob;
+import static com.azure.core.implementation.util.FluxUtil.withContext;
+import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse;
+
import com.azure.core.annotation.ServiceClient;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpResponse;
@@ -18,9 +21,9 @@
import com.azure.storage.blob.implementation.AzureBlobStorageImpl;
import com.azure.storage.blob.implementation.models.ContainersListBlobFlatSegmentResponse;
import com.azure.storage.blob.implementation.models.ContainersListBlobHierarchySegmentResponse;
+import com.azure.storage.blob.models.BlobContainerAccessConditions;
import com.azure.storage.blob.models.BlobContainerAccessPolicies;
import com.azure.storage.blob.models.BlobItem;
-import com.azure.storage.blob.models.BlobContainerAccessConditions;
import com.azure.storage.blob.models.CpkInfo;
import com.azure.storage.blob.models.LeaseAccessConditions;
import com.azure.storage.blob.models.ListBlobsOptions;
@@ -30,8 +33,6 @@
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.blob.models.StorageException;
import com.azure.storage.common.Utility;
-import reactor.core.publisher.Mono;
-
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
@@ -40,9 +41,7 @@
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-
-import static com.azure.core.implementation.util.FluxUtil.withContext;
-import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse;
+import reactor.core.publisher.Mono;
/**
* Client to a container. It may only be instantiated through a {@link BlobContainerClientBuilder} or via the method
@@ -143,7 +142,7 @@ public String getBlobContainerUrl() {
* @return The name of container.
*/
public String getBlobContainerName() {
- return BlobURLParts.parse(this.azureBlobStorage.getUrl(), logger).getBlobContainerName();
+ return BlobUrlParts.parse(this.azureBlobStorage.getUrl(), logger).getBlobContainerName();
}
/**
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 66dfdd95c45a..195c27154fee 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
@@ -18,11 +18,10 @@
import com.azure.storage.blob.models.SignedIdentifier;
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.common.Utility;
-import reactor.core.publisher.Mono;
-
import java.time.Duration;
import java.util.List;
import java.util.Map;
+import reactor.core.publisher.Mono;
/**
* Client to a container. It may only be instantiated through a {@link BlobContainerClientBuilder} or via the method
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClientBuilder.java
index 02e6786dfd7c..77aece5705f2 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClientBuilder.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerClientBuilder.java
@@ -8,7 +8,6 @@
import com.azure.core.implementation.util.ImplUtils;
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.implementation.AzureBlobStorageBuilder;
-
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Objects;
@@ -93,7 +92,7 @@ public BlobContainerAsyncClient buildAsyncClient() {
public BlobContainerClientBuilder endpoint(String endpoint) {
try {
URL url = new URL(endpoint);
- BlobURLParts parts = BlobURLParts.parse(url);
+ BlobUrlParts parts = BlobUrlParts.parse(url);
this.endpoint = parts.getScheme() + "://" + parts.getHost();
this.containerName = parts.getBlobContainerName();
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 8dad684c6c19..034d6f985c22 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
@@ -3,6 +3,9 @@
package com.azure.storage.blob;
+import static com.azure.core.implementation.util.FluxUtil.withContext;
+import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse;
+
import com.azure.core.annotation.ServiceClient;
import com.azure.core.credentials.TokenCredential;
import com.azure.core.http.HttpPipeline;
@@ -27,15 +30,11 @@
import com.azure.storage.blob.models.StorageServiceStats;
import com.azure.storage.blob.models.UserDelegationKey;
import com.azure.storage.common.Utility;
-import reactor.core.publisher.Mono;
-
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.Map;
import java.util.function.Function;
-
-import static com.azure.core.implementation.util.FluxUtil.withContext;
-import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse;
+import reactor.core.publisher.Mono;
/**
* Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does
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 0bb9ecc96066..27cc6fb593b7 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
@@ -18,11 +18,10 @@
import com.azure.storage.blob.models.StorageServiceStats;
import com.azure.storage.blob.models.UserDelegationKey;
import com.azure.storage.common.Utility;
-import reactor.core.publisher.Mono;
-
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.Map;
+import reactor.core.publisher.Mono;
/**
* Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java
index 6ffeb09ecaf8..1cf884c8f4a4 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java
@@ -8,7 +8,6 @@
import com.azure.core.implementation.util.ImplUtils;
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.implementation.AzureBlobStorageBuilder;
-
import java.net.MalformedURLException;
import java.net.URL;
@@ -76,7 +75,7 @@ public BlobServiceClientBuilder endpoint(String endpoint) {
URL url = new URL(endpoint);
super.endpoint = url.getProtocol() + "://" + url.getAuthority();
- String sasToken = BlobURLParts.parse(url).getSasQueryParameters().encode();
+ String sasToken = BlobUrlParts.parse(url).getSasQueryParameters().encode();
if (!ImplUtils.isNullOrEmpty(sasToken)) {
super.sasToken(sasToken);
}
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobURLParts.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobUrlParts.java
similarity index 88%
rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobURLParts.java
rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobUrlParts.java
index 7d6869a87842..fa7cd69963fb 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobURLParts.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobUrlParts.java
@@ -23,7 +23,7 @@
* existing URL into its parts with the {@link #parse(URL)} class. You may construct a URL from parts by calling {@link
* #toURL()}.
*/
-public final class BlobURLParts {
+public final class BlobUrlParts {
private String scheme;
private String host;
private String containerName;
@@ -33,9 +33,9 @@ public final class BlobURLParts {
private Map unparsedParameters;
/**
- * Initializes a BlobURLParts object which helps aid in the construction of a Blob Storage URL.
+ * Initializes a BlobUrlParts object which helps aid in the construction of a Blob Storage URL.
*/
- public BlobURLParts() {
+ public BlobUrlParts() {
unparsedParameters = new HashMap<>();
}
@@ -52,9 +52,9 @@ public String getScheme() {
* Sets the URL scheme, ex. "https://".
*
* @param scheme The URL scheme.
- * @return the updated BlobURLParts object.
+ * @return the updated BlobUrlParts object.
*/
- public BlobURLParts setScheme(String scheme) {
+ public BlobUrlParts setScheme(String scheme) {
this.scheme = scheme;
return this;
}
@@ -72,9 +72,9 @@ public String getHost() {
* Sets the URL host, ex. "account.blob.core.windows.net".
*
* @param host The URL host.
- * @return the updated BlobURLParts object.
+ * @return the updated BlobUrlParts object.
*/
- public BlobURLParts setHost(String host) {
+ public BlobUrlParts setHost(String host) {
this.host = host;
return this;
}
@@ -92,9 +92,9 @@ public String getBlobContainerName() {
* Sets the container name that will be used as part of the URL path.
*
* @param containerName The container nme.
- * @return the updated BlobURLParts object.
+ * @return the updated BlobUrlParts object.
*/
- public BlobURLParts setContainerName(String containerName) {
+ public BlobUrlParts setContainerName(String containerName) {
this.containerName = containerName;
return this;
}
@@ -112,9 +112,9 @@ public String getBlobName() {
* Sets the blob name that will be used as part of the URL path.
*
* @param blobName The blob name.
- * @return the updated BlobURLParts object.
+ * @return the updated BlobUrlParts object.
*/
- public BlobURLParts setBlobName(String blobName) {
+ public BlobUrlParts setBlobName(String blobName) {
this.blobName = blobName;
return this;
}
@@ -132,9 +132,9 @@ public String getSnapshot() {
* Sets the snapshot identifier that will be used as part of the query string if set.
*
* @param snapshot The snapshot identifier.
- * @return the updated BlobURLParts object.
+ * @return the updated BlobUrlParts object.
*/
- public BlobURLParts setSnapshot(String snapshot) {
+ public BlobUrlParts setSnapshot(String snapshot) {
this.snapshot = snapshot;
return this;
}
@@ -154,9 +154,9 @@ public BlobServiceSasQueryParameters getSasQueryParameters() {
* generate the SAS token for this URL.
*
* @param blobServiceSasQueryParameters The SAS query parameters.
- * @return the updated BlobURLParts object.
+ * @return the updated BlobUrlParts object.
*/
- public BlobURLParts setSasQueryParameters(BlobServiceSasQueryParameters blobServiceSasQueryParameters) {
+ public BlobUrlParts setSasQueryParameters(BlobServiceSasQueryParameters blobServiceSasQueryParameters) {
this.blobServiceSasQueryParameters = blobServiceSasQueryParameters;
return this;
}
@@ -174,9 +174,9 @@ public Map getUnparsedParameters() {
* Sets the query string parameters that aren't part of the SAS token that will be used by this URL.
*
* @param unparsedParameters The non-SAS token query string values.
- * @return the updated BlobURLParts object.
+ * @return the updated BlobUrlParts object.
*/
- public BlobURLParts setUnparsedParameters(Map unparsedParameters) {
+ public BlobUrlParts setUnparsedParameters(Map unparsedParameters) {
this.unparsedParameters = unparsedParameters;
return this;
}
@@ -185,7 +185,7 @@ public BlobURLParts setUnparsedParameters(Map unparsedParamete
* Converts the blob URL parts to a {@link URL}.
*
* @return A {@code URL} to the blob resource composed of all the elements in this object.
- * @throws MalformedURLException The fields present on the BlobURLParts object were insufficient to construct a
+ * @throws MalformedURLException The fields present on the BlobUrlParts object were insufficient to construct a
* valid URL or were ill-formatted.
*/
public URL toURL() throws MalformedURLException {
@@ -221,16 +221,16 @@ public URL toURL() throws MalformedURLException {
}
/**
- * URLParser parses a string URL initializing BlobURLParts' fields including any SAS-related and snapshot query
+ * URLParser parses a string URL initializing BlobUrlParts' fields including any SAS-related and snapshot query
* parameters. Any other query parameters remain in the UnparsedParams field. This method overwrites all fields
- * in the BlobURLParts object.
+ * in the BlobUrlParts object.
*
* @param url The string URL to be parsed.
* @param logger Logger associated to the calling class to log a {@link MalformedURLException}.
- * @return A {@link BlobURLParts} object containing all the components of a BlobURL.
+ * @return A {@link BlobUrlParts} object containing all the components of a BlobURL.
* @throws IllegalArgumentException If the {@code url} is malformed.
*/
- public static BlobURLParts parse(String url, ClientLogger logger) {
+ public static BlobUrlParts parse(String url, ClientLogger logger) {
try {
return parse(new URL(url));
} catch (MalformedURLException e) {
@@ -240,16 +240,16 @@ public static BlobURLParts parse(String url, ClientLogger logger) {
}
/**
- * Parses an existing URL into a BlobURLParts.
+ * Parses an existing URL into a BlobUrlParts.
*
* Query parameters will be parsed into two properties, {@link BlobServiceSasQueryParameters} which contains
* all SAS token related values and {@link #getUnparsedParameters() unparsedParameters} which is all other query
* parameters.
*
* @param url The {@code URL} to be parsed.
- * @return A {@link BlobURLParts} object containing all the components of a BlobURL.
+ * @return A {@link BlobUrlParts} object containing all the components of a BlobURL.
*/
- public static BlobURLParts parse(URL url) {
+ public static BlobUrlParts parse(URL url) {
final String scheme = url.getProtocol();
final String host = url.getHost();
@@ -287,7 +287,7 @@ public static BlobURLParts parse(URL url) {
BlobServiceSasQueryParameters blobServiceSasQueryParameters =
new BlobServiceSasQueryParameters(queryParamsMap, true);
- return new BlobURLParts()
+ return new BlobUrlParts()
.setScheme(scheme)
.setHost(host)
.setContainerName(containerName)
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/HttpGetterInfo.java
similarity index 85%
rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java
rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/HttpGetterInfo.java
index b13fa48a2acb..efba9e6f43ef 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/HttpGetterInfo.java
@@ -10,10 +10,10 @@
import java.time.Duration;
/**
- * HTTPGetterInfo is a passed to the getter function of a reliable download to specify parameters needed for the GET
+ * HttpGetterInfo is a passed to the getter function of a reliable download to specify parameters needed for the GET
* request.
*/
-public final class HTTPGetterInfo {
+public final class HttpGetterInfo {
private long offset = 0;
private Long count = null;
@@ -31,9 +31,9 @@ public long getOffset() {
* Sets the start offset that is used when creating the Range header. If unchanged this will default to 0.
*
* @param offset Start offset
- * @return the updated HTTPGetterInfo object
+ * @return the updated HttpGetterInfo object
*/
- public HTTPGetterInfo setOffset(long offset) {
+ public HttpGetterInfo setOffset(long offset) {
this.offset = offset;
return this;
}
@@ -51,9 +51,9 @@ public Long getCount() {
* default and indicates that the entire rest of the blob should be retrieved.
*
* @param count Count of bytes
- * @return the updated HTTPGetterInfo object
+ * @return the updated HttpGetterInfo object
*/
- public HTTPGetterInfo setCount(Long count) {
+ public HttpGetterInfo setCount(Long count) {
if (count != null) {
Utility.assertInBounds("count", count, 0, Long.MAX_VALUE);
}
@@ -76,9 +76,9 @@ public String getETag() {
* properties}. Defaults to null.
*
* @param eTag Resource's eTag
- * @return the updated HTTPGetterInfo object
+ * @return the updated HttpGetterInfo object
*/
- public HTTPGetterInfo setETag(String eTag) {
+ public HttpGetterInfo setETag(String eTag) {
this.eTag = eTag;
return this;
}
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 d50317535180..1f366064fbb0 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
@@ -3,6 +3,9 @@
package com.azure.storage.blob.specialized;
+import static com.azure.core.implementation.util.FluxUtil.withContext;
+import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse;
+
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpResponse;
import com.azure.core.http.rest.Response;
@@ -11,8 +14,8 @@
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.BlobProperties;
-import com.azure.storage.blob.BlobURLParts;
-import com.azure.storage.blob.HTTPGetterInfo;
+import com.azure.storage.blob.BlobUrlParts;
+import com.azure.storage.blob.HttpGetterInfo;
import com.azure.storage.blob.implementation.AzureBlobStorageBuilder;
import com.azure.storage.blob.implementation.AzureBlobStorageImpl;
import com.azure.storage.blob.models.AccessTier;
@@ -31,10 +34,6 @@
import com.azure.storage.blob.models.StorageException;
import com.azure.storage.common.Constants;
import com.azure.storage.common.Utility;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-import reactor.core.scheduler.Schedulers;
-
import java.io.IOException;
import java.io.OutputStream;
import java.io.UncheckedIOException;
@@ -47,9 +46,9 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-
-import static com.azure.core.implementation.util.FluxUtil.withContext;
-import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
/**
* This class provides a client that contains all operations that apply to any blob type.
@@ -123,7 +122,7 @@ public String getBlobUrl() {
* @return The name of the container.
*/
public final String getContainerName() {
- return BlobURLParts.parse(this.azureBlobStorage.getUrl(), logger).getBlobContainerName();
+ return BlobUrlParts.parse(this.azureBlobStorage.getUrl(), logger).getBlobContainerName();
}
/**
@@ -136,7 +135,7 @@ public final String getContainerName() {
* @return The name of the blob.
*/
public final String getBlobName() {
- return BlobURLParts.parse(this.azureBlobStorage.getUrl(), logger).getBlobName();
+ return BlobUrlParts.parse(this.azureBlobStorage.getUrl(), logger).getBlobName();
}
/**
@@ -456,7 +455,7 @@ Mono download(BlobRange range, BlobAccessConditions acces
range = range == null ? new BlobRange(0) : range;
Boolean getMD5 = rangeGetContentMD5 ? rangeGetContentMD5 : null;
accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions;
- HTTPGetterInfo info = new HTTPGetterInfo()
+ HttpGetterInfo info = new HttpGetterInfo()
.setOffset(range.getOffset())
.setCount(range.getCount())
.setETag(accessConditions.getModifiedAccessConditions().getIfMatch());
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 18bbb6774ae3..4fb21899d661 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
@@ -25,8 +25,6 @@
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.blob.models.StorageException;
import com.azure.storage.common.Utility;
-import reactor.core.publisher.Mono;
-
import java.io.IOException;
import java.io.OutputStream;
import java.io.UncheckedIOException;
@@ -34,6 +32,7 @@
import java.nio.file.FileAlreadyExistsException;
import java.time.Duration;
import java.util.Map;
+import reactor.core.publisher.Mono;
/**
* This class provides a client that contains all operations that apply to any blob type.
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobServiceSasQueryParameters.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobServiceSasQueryParameters.java
index 7e4cdafa92cb..f795f1801c06 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobServiceSasQueryParameters.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobServiceSasQueryParameters.java
@@ -8,7 +8,7 @@
import com.azure.storage.common.BaseSasQueryParameters;
import com.azure.storage.common.Constants;
import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
+import com.azure.storage.common.SasProtocol;
import com.azure.storage.common.Utility;
import java.time.OffsetDateTime;
@@ -26,9 +26,9 @@ public final class BlobServiceSasQueryParameters extends BaseSasQueryParameters
private final String identifier;
- private final String keyOid;
+ private final String keyObjectId;
- private final String keyTid;
+ private final String keyTenantId;
private final OffsetDateTime keyStart;
@@ -61,9 +61,9 @@ public BlobServiceSasQueryParameters(Map queryParamsMap, boole
super(queryParamsMap, removeSASParametersFromMap);
this.identifier = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_IDENTIFIER,
removeSASParametersFromMap);
- this.keyOid = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_OBJECT_ID,
+ this.keyObjectId = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_OBJECT_ID,
removeSASParametersFromMap);
- this.keyTid = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_TENANT_ID,
+ this.keyTenantId = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_TENANT_ID,
removeSASParametersFromMap);
this.keyStart = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_KEY_START,
removeSASParametersFromMap, Utility::parseDate);
@@ -102,7 +102,7 @@ public BlobServiceSasQueryParameters(Map queryParamsMap, boole
* @param permissions A {@code String} representing the storage permissions or {@code null}.
* @param signature A {@code String} representing the signature for the SAS token.
*/
- BlobServiceSasQueryParameters(String version, SASProtocol protocol, OffsetDateTime startTime,
+ BlobServiceSasQueryParameters(String version, SasProtocol protocol, OffsetDateTime startTime,
OffsetDateTime expiryTime, IpRange ipRange, String identifier, String resource, String permissions,
String signature, String cacheControl, String contentDisposition, String contentEncoding,
String contentLanguage, String contentType, UserDelegationKey key) {
@@ -117,15 +117,15 @@ public BlobServiceSasQueryParameters(Map queryParamsMap, boole
this.contentType = contentType;
if (key != null) {
- this.keyOid = key.getSignedOid();
- this.keyTid = key.getSignedTid();
+ this.keyObjectId = key.getSignedOid();
+ this.keyTenantId = key.getSignedTid();
this.keyStart = key.getSignedStart();
this.keyExpiry = key.getSignedExpiry();
this.keyService = key.getSignedService();
this.keyVersion = key.getSignedVersion();
} else {
- this.keyOid = null;
- this.keyTid = null;
+ this.keyObjectId = null;
+ this.keyTenantId = null;
this.keyStart = null;
this.keyExpiry = null;
this.keyService = null;
@@ -187,15 +187,15 @@ public String getContentType() {
/**
* @return the object ID of the key.
*/
- public String getKeyOid() {
- return keyOid;
+ public String getKeyObjectId() {
+ return keyObjectId;
}
/**
* @return the tenant ID of the key.
*/
- public String getKeyTid() {
- return keyTid;
+ public String getKeyTenantId() {
+ return keyTenantId;
}
/**
@@ -229,10 +229,10 @@ public String getKeyVersion() {
UserDelegationKey userDelegationKey() {
return new UserDelegationKey()
.setSignedExpiry(this.keyExpiry)
- .setSignedOid(this.keyOid)
+ .setSignedOid(this.keyObjectId)
.setSignedService(this.keyService)
.setSignedStart(this.keyStart)
- .setSignedTid(this.keyTid)
+ .setSignedTid(this.keyTenantId)
.setSignedVersion(this.keyVersion);
}
@@ -254,8 +254,8 @@ public String encode() {
tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_EXPIRY_TIME, formatQueryParameterDate(this.expiryTime));
tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_IP_RANGE, this.ipRange);
tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_IDENTIFIER, this.identifier);
- tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_OBJECT_ID, this.keyOid);
- tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_TENANT_ID, this.keyTid);
+ 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,
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobServiceSasSignatureValues.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobServiceSasSignatureValues.java
index 3f4187ad1d3a..565d31a794ae 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobServiceSasSignatureValues.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobServiceSasSignatureValues.java
@@ -9,7 +9,7 @@
import com.azure.storage.blob.models.UserDelegationKey;
import com.azure.storage.common.Constants;
import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
+import com.azure.storage.common.SasProtocol;
import com.azure.storage.common.Utility;
import com.azure.storage.common.credentials.SharedKeyCredential;
@@ -39,7 +39,7 @@ public final class BlobServiceSasSignatureValues {
private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- private SASProtocol protocol;
+ private SasProtocol protocol;
private OffsetDateTime startTime;
@@ -93,7 +93,7 @@ public BlobServiceSasSignatureValues() {
this.identifier = identifier;
}
- public BlobServiceSasSignatureValues(String version, SASProtocol sasProtocol, OffsetDateTime startTime,
+ public BlobServiceSasSignatureValues(String version, SasProtocol sasProtocol, OffsetDateTime startTime,
OffsetDateTime expiryTime, String permission, IpRange ipRange, String identifier, String cacheControl,
String contentDisposition, String contentEncoding, String contentLanguage, String contentType) {
if (version != null) {
@@ -133,19 +133,19 @@ public BlobServiceSasSignatureValues setVersion(String version) {
}
/**
- * @return the {@link SASProtocol} which determines the protocols allowed by the SAS.
+ * @return the {@link SasProtocol} which determines the protocols allowed by the SAS.
*/
- public SASProtocol getProtocol() {
+ public SasProtocol getProtocol() {
return protocol;
}
/**
- * Sets the {@link SASProtocol} which determines the protocols allowed by the SAS.
+ * Sets the {@link SasProtocol} which determines the protocols allowed by the SAS.
*
* @param protocol Protocol for the SAS
* @return the updated BlobServiceSASSignatureValues object
*/
- public BlobServiceSasSignatureValues setProtocol(SASProtocol protocol) {
+ public BlobServiceSasSignatureValues setProtocol(SasProtocol protocol) {
this.protocol = protocol;
return this;
}
@@ -450,7 +450,7 @@ public BlobServiceSasSignatureValues setContentType(String contentType) {
* @throws NullPointerException if {@code sharedKeyCredentials} is null. Or if any of {@code version},
* {@code canonicalName}, {@code resource} or {@code identifier} are null.
*/
- public BlobServiceSasQueryParameters generateSASQueryParameters(SharedKeyCredential sharedKeyCredentials) {
+ public BlobServiceSasQueryParameters generateSasQueryParameters(SharedKeyCredential sharedKeyCredentials) {
Utility.assertNotNull("sharedKeyCredentials", sharedKeyCredentials);
assertGenerateOK(false);
@@ -472,7 +472,7 @@ public BlobServiceSasQueryParameters generateSASQueryParameters(SharedKeyCredent
* @throws NullPointerException if {@code delegationKey} is null. Or if any of {@code version},
* {@code canonicalName}, {@code resource}, {@code expiryTime} or {@code permissions} are null.
*/
- public BlobServiceSasQueryParameters generateSASQueryParameters(UserDelegationKey delegationKey) {
+ public BlobServiceSasQueryParameters generateSasQueryParameters(UserDelegationKey delegationKey) {
Utility.assertNotNull("delegationKey", delegationKey);
assertGenerateOK(true);
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/DownloadAsyncResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/DownloadAsyncResponse.java
index 1eba60c444fe..e59878350865 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/DownloadAsyncResponse.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/DownloadAsyncResponse.java
@@ -4,7 +4,7 @@
package com.azure.storage.blob.specialized;
import com.azure.core.http.rest.ResponseBase;
-import com.azure.storage.blob.HTTPGetterInfo;
+import com.azure.storage.blob.HttpGetterInfo;
import com.azure.storage.blob.models.BlobDownloadHeaders;
import com.azure.storage.blob.models.ReliableDownloadOptions;
import com.azure.storage.common.Utility;
@@ -31,16 +31,16 @@
* retry mechanism.
*/
public final class DownloadAsyncResponse {
- private final HTTPGetterInfo info;
+ private final HttpGetterInfo info;
private final ResponseBase> rawResponse;
- private final Function> getter;
+ private final Function> getter;
// The constructor is package-private because customers should not be creating their own responses.
DownloadAsyncResponse(ResponseBase> response,
- HTTPGetterInfo info, Function> getter) {
+ HttpGetterInfo info, Function> getter) {
Utility.assertNotNull("getter", getter);
Utility.assertNotNull("info", info);
Utility.assertNotNull("info.eTag", info.getETag());
diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/SpecializedBlobClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/SpecializedBlobClientBuilder.java
index 1e5f431cef89..6feb4a73d8e5 100644
--- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/SpecializedBlobClientBuilder.java
+++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/SpecializedBlobClientBuilder.java
@@ -8,7 +8,7 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.BaseBlobClientBuilder;
import com.azure.storage.blob.BlobContainerAsyncClient;
-import com.azure.storage.blob.BlobURLParts;
+import com.azure.storage.blob.BlobUrlParts;
import com.azure.storage.blob.BlobContainerClient;
import com.azure.storage.blob.implementation.AzureBlobStorageBuilder;
import com.azure.storage.blob.implementation.AzureBlobStorageImpl;
@@ -202,7 +202,7 @@ public SpecializedBlobClientBuilder containerAsyncClient(BlobContainerAsyncClien
public SpecializedBlobClientBuilder endpoint(String endpoint) {
try {
URL url = new URL(endpoint);
- BlobURLParts parts = BlobURLParts.parse(url);
+ BlobUrlParts parts = BlobUrlParts.parse(url);
this.endpoint = parts.getScheme() + "://" + parts.getHost();
this.containerName = parts.getBlobContainerName();
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 f0a199d5294d..4fad58a9aa1a 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
@@ -14,8 +14,6 @@
import com.azure.storage.blob.models.RehydratePriority;
import com.azure.storage.blob.models.ReliableDownloadOptions;
import com.azure.storage.blob.specialized.BlobAsyncClientBase;
-import reactor.core.publisher.Flux;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
@@ -26,6 +24,7 @@
import java.util.Base64;
import java.util.Collections;
import java.util.Map;
+import reactor.core.publisher.Flux;
/**
* Code snippets for {@link BlobAsyncClient}
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 fc7ab8622035..e68edcee67ac 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
@@ -17,7 +17,6 @@
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.blob.specialized.BlobClientBase;
import com.azure.storage.common.Constants;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
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 1e9520302f9f..842877dd4888 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
@@ -12,7 +12,6 @@
import com.azure.storage.blob.models.ModifiedAccessConditions;
import com.azure.storage.blob.models.PublicAccessType;
import com.azure.storage.blob.models.SignedIdentifier;
-
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.Collections;
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 743a4f8bd461..374084c4513b 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
@@ -6,8 +6,8 @@
import com.azure.core.util.Context;
import com.azure.storage.blob.models.AccessPolicy;
import com.azure.storage.blob.models.BlobContainerAccessConditions;
-import com.azure.storage.blob.models.BlobListDetails;
import com.azure.storage.blob.models.BlobContainerAccessPolicies;
+import com.azure.storage.blob.models.BlobListDetails;
import com.azure.storage.blob.models.LeaseAccessConditions;
import com.azure.storage.blob.models.ListBlobsOptions;
import com.azure.storage.blob.models.ModifiedAccessConditions;
@@ -16,7 +16,6 @@
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.blob.models.StorageErrorCode;
import com.azure.storage.blob.models.StorageException;
-
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.Collections;
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 acd4dc10390d..6c499f745c80 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,7 +12,6 @@
import com.azure.storage.blob.models.RetentionPolicy;
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.blob.models.StorageServiceProperties;
-
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.Collections;
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 03b5faa90702..7441ed1670f9 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
@@ -13,7 +13,6 @@
import com.azure.storage.blob.models.ParallelTransferOptions;
import com.azure.storage.blob.models.RehydratePriority;
import com.azure.storage.blob.models.ReliableDownloadOptions;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
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 73bf9057425e..84ceb5788492 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
@@ -17,7 +17,6 @@
import com.azure.storage.blob.models.ReliableDownloadOptions;
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.common.Constants;
-
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.UncheckedIOException;
diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy
index cb2b3457b647..889736f0220d 100644
--- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy
+++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy
@@ -35,8 +35,8 @@ import com.azure.storage.blob.specialized.LeaseClient
import com.azure.storage.blob.specialized.LeaseClientBuilder
import com.azure.storage.common.BaseClientBuilder
import com.azure.storage.common.Constants
-
import com.azure.storage.common.credentials.SharedKeyCredential
+import com.azure.storage.common.implementation.credentials.SasTokenCredential
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
import spock.lang.Requires
diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy
index 31f1601b4dac..69e0f72ab08c 100644
--- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy
+++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy
@@ -94,15 +94,15 @@ class BlobAPITest extends APISpec {
/*
This is to test the appropriate integration of DownloadResponse, including setting the correct range values on
- HTTPGetterInfo.
+ HttpGetterInfo.
*/
def "Download with retry range"() {
/*
We are going to make a request for some range on a blob. The Flux returned will throw an exception, forcing
a retry per the ReliableDownloadOptions. The next request should have the same range header, which was generated
- from the count and offset values in HTTPGetterInfo that was constructed on the initial call to download. We
+ from the count and offset values in HttpGetterInfo that was constructed on the initial call to download. We
don't need to check the data here, but we want to ensure that the correct range is set each time. This will
- test the correction of a bug that was found which caused HTTPGetterInfo to have an incorrect offset when it was
+ test the correction of a bug that was found which caused HttpGetterInfo to have an incorrect offset when it was
constructed in BlobClient.download().
*/
setup:
@@ -1459,7 +1459,7 @@ class BlobAPITest extends APISpec {
.setExpiryTime(OffsetDateTime.now().plusHours(1))
.setPermissions(new BlobSasPermission().setReadPermission(true))
.setCanonicalName(bc.getBlobUrl().toString(), primaryCredential.getAccountName())
- .generateSASQueryParameters(primaryCredential)
+ .generateSasQueryParameters(primaryCredential)
.encode()
bcCopy.copyFromURLWithResponse(new URL(bc.getBlobUrl().toString() + "?" + sas), null, tier2, null, null, null, null)
diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/CPKTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/CPKTest.groovy
index dd66b60a4c33..69d90c0120ef 100644
--- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/CPKTest.groovy
+++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/CPKTest.groovy
@@ -96,7 +96,7 @@ class CPKTest extends APISpec {
.setExpiryTime(OffsetDateTime.now().plusHours(1))
.setPermissions(new BlobSasPermission().setReadPermission(true))
.setCanonicalName(sourceBlob.getBlobUrl().toString(), primaryCredential.getAccountName())
- .generateSASQueryParameters(primaryCredential)
+ .generateSasQueryParameters(primaryCredential)
.encode()
def response = cpkBlockBlob.stageBlockFromURLWithResponse(getBlockID(), new URL(sourceBlob.getBlobUrl().toString() + "?" + sas),
@@ -151,7 +151,7 @@ class CPKTest extends APISpec {
.setExpiryTime(OffsetDateTime.now().plusHours(1))
.setPermissions(new BlobSasPermission().setReadPermission(true))
.setCanonicalName(sourceBlob.getBlobUrl().toString(), primaryCredential.getAccountName())
- .generateSASQueryParameters(primaryCredential)
+ .generateSasQueryParameters(primaryCredential)
.encode()
def response = cpkPageBlob.uploadPagesFromURLWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1),
@@ -202,7 +202,7 @@ class CPKTest extends APISpec {
.setExpiryTime(OffsetDateTime.now().plusHours(1))
.setPermissions(new BlobSasPermission().setReadPermission(true))
.setCanonicalName(sourceBlob.getBlobUrl().toString(), primaryCredential.getAccountName())
- .generateSASQueryParameters(primaryCredential)
+ .generateSasQueryParameters(primaryCredential)
.encode()
def response = cpkAppendBlob.appendBlockFromUrlWithResponse(new URL(sourceBlob.getBlobUrl().toString() + "?" + sas),
null, null, null, null, null, null)
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 3ff1e79a07d8..ad400b36046f 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
@@ -10,13 +10,13 @@ import com.azure.storage.blob.models.StorageException
import com.azure.storage.blob.models.UserDelegationKey
import com.azure.storage.blob.specialized.BlobServiceSasSignatureValues
import com.azure.storage.blob.specialized.SpecializedBlobClientBuilder
-import com.azure.storage.common.AccountSASPermission
-import com.azure.storage.common.AccountSASResourceType
-import com.azure.storage.common.AccountSASService
-import com.azure.storage.common.AccountSASSignatureValues
+import com.azure.storage.common.AccountSasResourceType
+import com.azure.storage.common.AccountSasService
+import com.azure.storage.common.AccountSasPermission
+import com.azure.storage.common.AccountSasSignatureValues
import com.azure.storage.common.Constants
import com.azure.storage.common.IpRange
-import com.azure.storage.common.SASProtocol
+import com.azure.storage.common.SasProtocol
import com.azure.storage.common.Utility
import com.azure.storage.common.credentials.SharedKeyCredential
import spock.lang.Ignore
@@ -110,7 +110,7 @@ class SASTest extends APISpec {
def ipRange = new IpRange()
.setIpMin("0.0.0.0")
.setIpMax("255.255.255.255")
- def sasProtocol = SASProtocol.HTTPS_HTTP
+ def sasProtocol = SasProtocol.HTTPS_HTTP
def cacheControl = "cache"
def contentDisposition = "disposition"
def contentEncoding = "encoding"
@@ -131,7 +131,7 @@ class SASTest extends APISpec {
.setContentType(contentType)
.setCanonicalName(bu.getBlobUrl(), primaryCredential.getAccountName())
.setSnapshotId(bu.getSnapshotId())
- .generateSASQueryParameters(primaryCredential)
+ .generateSasQueryParameters(primaryCredential)
.encode()
def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName).getBlockBlobClient()
@@ -171,7 +171,7 @@ class SASTest extends APISpec {
def ipRange = new IpRange()
.setIpMin("0.0.0.0")
.setIpMax("255.255.255.255")
- def sasProtocol = SASProtocol.HTTPS_HTTP
+ def sasProtocol = SasProtocol.HTTPS_HTTP
def cacheControl = "cache"
def contentDisposition = "disposition"
def contentEncoding = "encoding"
@@ -192,7 +192,7 @@ class SASTest extends APISpec {
.setContentType(contentType)
.setCanonicalName(snapshotBlob.getBlobUrl(), primaryCredential.getAccountName())
.setSnapshotId(snapshotBlob.getSnapshotId())
- .generateSASQueryParameters(primaryCredential)
+ .generateSasQueryParameters(primaryCredential)
.encode()
def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName, snapshotId).getBlockBlobClient()
@@ -234,7 +234,7 @@ class SASTest extends APISpec {
.setIdentifier(identifier.getId())
.setCanonicalName(cc.getBlobContainerUrl(), primaryCredential.getAccountName())
.setResource(Constants.UrlConstants.SAS_CONTAINER_CONSTANT)
- .generateSASQueryParameters(primaryCredential)
+ .generateSasQueryParameters(primaryCredential)
.encode()
def client1 = getContainerClient(sasWithId, cc.getBlobContainerUrl())
@@ -245,9 +245,8 @@ class SASTest extends APISpec {
.setPermissions(permissions)
.setExpiryTime(expiryTime)
.setCanonicalName(cc.getBlobContainerUrl().toString(), primaryCredential.getAccountName())
- .generateSASQueryParameters(primaryCredential)
+ .generateSasQueryParameters(primaryCredential)
.encode()
-
def client2 = getContainerClient(sasWithPermissions, cc.getBlobContainerUrl())
client2.listBlobsFlat().iterator().hasNext()
@@ -279,7 +278,7 @@ class SASTest extends APISpec {
.setIpMin("0.0.0.0")
.setIpMax("255.255.255.255")
- def sasProtocol = SASProtocol.HTTPS_HTTP
+ def sasProtocol = SasProtocol.HTTPS_HTTP
def cacheControl = "cache"
def contentDisposition = "disposition"
def contentEncoding = "encoding"
@@ -303,7 +302,7 @@ class SASTest extends APISpec {
.setCanonicalName(bu.getBlobUrl().toString(), primaryCredential.getAccountName())
.setSnapshotId(bu.getSnapshotId())
.setVersion(key.getSignedVersion())
- .generateSASQueryParameters(key)
+ .generateSasQueryParameters(key)
.encode()
then:
@@ -346,7 +345,7 @@ class SASTest extends APISpec {
def ipRange = new IpRange()
.setIpMin("0.0.0.0")
.setIpMax("255.255.255.255")
- def sasProtocol = SASProtocol.HTTPS_HTTP
+ def sasProtocol = SasProtocol.HTTPS_HTTP
def cacheControl = "cache"
def contentDisposition = "disposition"
def contentEncoding = "encoding"
@@ -367,7 +366,7 @@ class SASTest extends APISpec {
.setContentType(contentType)
.setCanonicalName(snapshotBlob.getBlobUrl(), primaryCredential.getAccountName())
.setSnapshotId(snapshotBlob.getSnapshotId())
- .generateSASQueryParameters(primaryCredential)
+ .generateSasQueryParameters(primaryCredential)
.encode()
and:
@@ -423,7 +422,7 @@ class SASTest extends APISpec {
.setIpMin("0.0.0.0")
.setIpMax("255.255.255.255")
- def sasProtocol = SASProtocol.HTTPS_HTTP
+ def sasProtocol = SasProtocol.HTTPS_HTTP
def cacheControl = "cache"
def contentDisposition = "disposition"
def contentEncoding = "encoding"
@@ -447,7 +446,7 @@ class SASTest extends APISpec {
.setCanonicalName(snapshotBlob.getBlobUrl().toString(), primaryCredential.getAccountName())
.setSnapshotId(snapshotBlob.getSnapshotId())
.setVersion(key.getSignedVersion())
- .generateSASQueryParameters(key)
+ .generateSasQueryParameters(key)
.encode()
// base blob with snapshot SAS
@@ -498,7 +497,7 @@ class SASTest extends APISpec {
.setPermissions(permissions)
.setExpiryTime(expiryTime)
.setCanonicalName(cc.getBlobContainerUrl().toString(), primaryCredential.getAccountName())
- .generateSASQueryParameters(key)
+ .generateSasQueryParameters(key)
.encode()
def client = getContainerClient(sasWithPermissions, cc.getBlobContainerUrl())
@@ -515,18 +514,18 @@ class SASTest extends APISpec {
def bu = cc.getBlobClient(blobName).getBlockBlobClient()
bu.upload(new ByteArrayInputStream(data), data.length)
- def service = new AccountSASService()
+ def service = new AccountSasService()
.setBlob(true)
- def resourceType = new AccountSASResourceType()
+ def resourceType = new AccountSasResourceType()
.setContainer(true)
.setService(true)
.setObject(true)
- def permissions = new AccountSASPermission()
+ def permissions = new AccountSasPermission()
.setReadPermission(true)
def expiryTime = getUTCNow().plusDays(1)
when:
- def sas = AccountSASSignatureValues.generateAccountSAS(primaryCredential, service, resourceType, permissions, expiryTime, null, null, null, null)
+ def sas = AccountSasSignatureValues.generateAccountSas(primaryCredential, service, resourceType, permissions, expiryTime, null, null, null, null)
def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName).getBlockBlobClient()
def os = new ByteArrayOutputStream()
@@ -543,18 +542,18 @@ class SASTest extends APISpec {
def bu = cc.getBlobClient(blobName).getBlockBlobClient()
bu.upload(new ByteArrayInputStream(data), data.length)
- def service = new AccountSASService()
+ def service = new AccountSasService()
.setBlob(true)
- def resourceType = new AccountSASResourceType()
+ def resourceType = new AccountSasResourceType()
.setContainer(true)
.setService(true)
.setObject(true)
- def permissions = new AccountSASPermission()
+ def permissions = new AccountSasPermission()
.setReadPermission(true)
def expiryTime = getUTCNow().plusDays(1)
when:
- def sas = AccountSASSignatureValues.generateAccountSAS(primaryCredential, service, resourceType, permissions, expiryTime, null, null, null, null)
+ def sas = AccountSasSignatureValues.generateAccountSas(primaryCredential, service, resourceType, permissions, expiryTime, null, null, null, null)
def client = getBlobClient(sas, cc.getBlobContainerUrl(), blobName).getBlockBlobClient()
client.delete()
@@ -565,19 +564,19 @@ class SASTest extends APISpec {
def "accountSAS network create container fails"() {
setup:
- def service = new AccountSASService()
+ def service = new AccountSasService()
.setBlob(true)
- def resourceType = new AccountSASResourceType()
+ def resourceType = new AccountSasResourceType()
.setContainer(true)
.setService(true)
.setObject(true)
- def permissions = new AccountSASPermission()
+ def permissions = new AccountSasPermission()
.setReadPermission(true)
.setCreatePermission(false)
def expiryTime = getUTCNow().plusDays(1)
when:
- def sas = AccountSASSignatureValues.generateAccountSAS(primaryCredential, service, resourceType, permissions, expiryTime, null, null, null, null)
+ def sas = AccountSasSignatureValues.generateAccountSas(primaryCredential, service, resourceType, permissions, expiryTime, null, null, null, null)
def sc = getServiceClient(sas, primaryBlobServiceClient.getAccountUrl())
sc.createBlobContainer(generateContainerName())
@@ -588,20 +587,19 @@ class SASTest extends APISpec {
def "accountSAS network create container succeeds"() {
setup:
- def service = new AccountSASService()
+ def service = new AccountSasService()
.setBlob(true)
- def resourceType = new AccountSASResourceType()
+ def resourceType = new AccountSasResourceType()
.setContainer(true)
.setService(true)
.setObject(true)
- def permissions = new AccountSASPermission()
+ def permissions = new AccountSasPermission()
.setReadPermission(true)
.setCreatePermission(true)
def expiryTime = getUTCNow().plusDays(1)
when:
- def sas = AccountSASSignatureValues.generateAccountSAS(primaryCredential, service, resourceType, permissions, expiryTime, null, null, null, null)
-
+ def sas = AccountSasSignatureValues.generateAccountSas(primaryCredential, service, resourceType, permissions, expiryTime, null, null, null, null)
def sc = getServiceClient(sas, primaryBlobServiceClient.getAccountUrl())
sc.createBlobContainer(generateContainerName())
@@ -643,7 +641,7 @@ class SASTest extends APISpec {
.setContentType(type)
v.setResource("bs")
- def token = v.generateSASQueryParameters(primaryCredential)
+ def token = v.generateSasQueryParameters(primaryCredential)
then:
token.getSignature() == primaryCredential.computeHmac256(expectedStringToSign)
@@ -656,10 +654,10 @@ class SASTest extends APISpec {
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" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\n\n\n"
- null | "id" | null | null | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\nid\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\n\n\n"
- null | null | new IpRange() | null | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\nip\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\n\n\n"
- null | null | null | SASProtocol.HTTPS_ONLY | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n" + SASProtocol.HTTPS_ONLY + "\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\n\n\n"
- null | null | null | null | "snapId" | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\nsnapId\n\n\n\n\n"
+ null | "id" | null | null | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\nid\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\n\n\n"
+ null | null | new IpRange() | null | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\nip\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\n\n\n"
+ null | null | null | SasProtocol.HTTPS_ONLY | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n" + SasProtocol.HTTPS_ONLY + "\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\n\n\n"
+ null | null | null | null | "snapId" | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/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" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\ncontrol\n\n\n\n"
null | null | null | null | null | null | "disposition" | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\ndisposition\n\n\n"
null | null | null | null | null | null | null | "encoding" | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\nencoding\n\n"
@@ -702,7 +700,7 @@ class SASTest extends APISpec {
.setSignedService(keyService)
.setSignedVersion(keyVersion)
.setValue(keyValue)
- def token = v.generateSASQueryParameters(key)
+ def token = v.generateSasQueryParameters(key)
then:
token.getSignature() == Utility.computeHMac256(key.getValue(), expectedStringToSign)
@@ -719,9 +717,9 @@ class SASTest extends APISpec {
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" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n2018-01-01T00:00:00Z\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\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" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n\nb\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\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" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n\n\n2018-06-17\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\n\n\n"
- null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | new IpRange() | null | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n\n\n\nip\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\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" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n\n\n\n\n" + SASProtocol.HTTPS_ONLY + "\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\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" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/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=" | new IpRange() | null | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n\n\n\nip\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\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" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n\n\n\n\n" + SasProtocol.HTTPS_ONLY + "\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\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" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/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" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\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" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\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" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\nencoding\n\n"
@@ -737,7 +735,7 @@ class SASTest extends APISpec {
.setVersion(version)
when:
- v.generateSASQueryParameters((SharedKeyCredential) creds)
+ v.generateSasQueryParameters((SharedKeyCredential) creds)
then:
def e = thrown(NullPointerException)
@@ -897,12 +895,12 @@ class SASTest extends APISpec {
@Unroll
def "SASProtocol parse"() {
expect:
- SASProtocol.parse(protocolStr) == protocol
+ SasProtocol.parse(protocolStr) == protocol
where:
protocolStr || protocol
- "https" || SASProtocol.HTTPS_ONLY
- "https,http" || SASProtocol.HTTPS_HTTP
+ "https" || SasProtocol.HTTPS_ONLY
+ "https,http" || SasProtocol.HTTPS_HTTP
}
@Unroll
@@ -921,9 +919,9 @@ class SASTest extends APISpec {
}
if (usingUserDelegation) {
- serviceSASSignatureValues.generateSASQueryParameters(new UserDelegationKey())
+ serviceSASSignatureValues.generateSasQueryParameters(new UserDelegationKey())
} else {
- serviceSASSignatureValues.generateSASQueryParameters(new SharedKeyCredential("", ""))
+ serviceSASSignatureValues.generateSasQueryParameters(new SharedKeyCredential("", ""))
}
then:
@@ -949,8 +947,8 @@ class SASTest extends APISpec {
@Unroll
def "accountSasSignatures string to sign"() {
when:
- def v = new AccountSASSignatureValues()
- def p = new AccountSASPermission()
+ def v = new AccountSasSignatureValues()
+ def p = new AccountSasPermission()
.setReadPermission(true)
v.setPermissions(p.toString())
.setServices("b")
@@ -964,7 +962,7 @@ class SASTest extends APISpec {
}
v.setProtocol(protocol)
- def token = v.generateSASQueryParameters(primaryCredential)
+ def token = v.generateSasQueryParameters(primaryCredential)
then:
token.getSignature() == primaryCredential.computeHmac256(String.format(expectedStringToSign, primaryCredential.getAccountName()))
@@ -973,13 +971,13 @@ class SASTest extends APISpec {
startTime | ipRange | protocol || expectedStringToSign
OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | null | null || "%s" + "\nr\nb\no\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n"
null | new IpRange() | null || "%s" + "\nr\nb\no\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\nip\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n"
- null | null | SASProtocol.HTTPS_ONLY || "%s" + "\nr\nb\no\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n\n" + SASProtocol.HTTPS_ONLY + "\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n"
+ null | null | SasProtocol.HTTPS_ONLY || "%s" + "\nr\nb\no\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n\n" + SasProtocol.HTTPS_ONLY + "\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n"
}
@Unroll
def "accountSasSignatureValues IA"() {
setup:
- def v = new AccountSASSignatureValues()
+ def v = new AccountSasSignatureValues()
.setPermissions(permissions)
.setServices(service)
.setResourceTypes(resourceType)
@@ -987,7 +985,7 @@ class SASTest extends APISpec {
.setVersion(version)
when:
- v.generateSASQueryParameters(creds)
+ v.generateSasQueryParameters(creds)
then:
def e = thrown(NullPointerException)
@@ -1006,7 +1004,7 @@ class SASTest extends APISpec {
@Unroll
def "AccountSASPermissions toString"() {
setup:
- def perms = new AccountSASPermission()
+ def perms = new AccountSasPermission()
perms.setReadPermission(read)
.setWritePermission(write)
.setDeletePermission(delete)
@@ -1035,7 +1033,7 @@ class SASTest extends APISpec {
@Unroll
def "AccountSASPermissions parse"() {
when:
- def perms = AccountSASPermission.parse(permString)
+ def perms = AccountSasPermission.parse(permString)
then:
perms.getReadPermission() == read
@@ -1063,7 +1061,7 @@ class SASTest extends APISpec {
def "AccountSASPermissions parse IA"() {
when:
- AccountSASPermission.parse("rwaq")
+ AccountSasPermission.parse("rwaq")
then:
thrown(IllegalArgumentException)
@@ -1072,7 +1070,7 @@ class SASTest extends APISpec {
@Unroll
def "AccountSASResourceType toString"() {
setup:
- def resourceTypes = new AccountSASResourceType()
+ def resourceTypes = new AccountSasResourceType()
.setService(service)
.setContainer(container)
.setObject(object)
@@ -1091,12 +1089,12 @@ class SASTest extends APISpec {
@Unroll
def "AccountSASResourceType parse"() {
when:
- def resourceTypes = AccountSASResourceType.parse(resourceTypeString)
+ def resourceTypes = AccountSasResourceType.parse(resourceTypeString)
then:
resourceTypes.isService() == service
resourceTypes.isContainer() == container
- resourceTypes.getObject() == object
+ resourceTypes.isObject() == object
where:
resourceTypeString || service | container | object
@@ -1109,7 +1107,7 @@ class SASTest extends APISpec {
@Unroll
def "AccountSASResourceType IA"() {
when:
- AccountSASResourceType.parse("scq")
+ AccountSasResourceType.parse("scq")
then:
thrown(IllegalArgumentException)
@@ -1117,7 +1115,7 @@ class SASTest extends APISpec {
def "BlobURLParts"() {
setup:
- def parts = new BlobURLParts()
+ def parts = new BlobUrlParts()
parts.setScheme("http")
.setHost("host")
.setContainerName("container")
@@ -1128,7 +1126,7 @@ class SASTest extends APISpec {
.setCanonicalName("/containerName/blobName")
.setExpiryTime(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC))
.setResource("bs")
- parts.setSasQueryParameters(sasValues.generateSASQueryParameters(primaryCredential))
+ parts.setSasQueryParameters(sasValues.generateSasQueryParameters(primaryCredential))
when:
def splitParts = parts.toURL().toString().split("\\?")
@@ -1144,7 +1142,7 @@ class SASTest extends APISpec {
def "URLParser"() {
when:
- def parts = BlobURLParts.parse(new URL("http://host/container/blob?snapshot=snapshot&sv=" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "&sr=c&sp=r&sig=Ee%2BSodSXamKSzivSdRTqYGh7AeMVEk3wEoRZ1yzkpSc%3D"))
+ def parts = BlobUrlParts.parse(new URL("http://host/container/blob?snapshot=snapshot&sv=" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "&sr=c&sp=r&sig=Ee%2BSodSXamKSzivSdRTqYGh7AeMVEk3wEoRZ1yzkpSc%3D"))
then:
parts.getScheme() == "http"
diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseMockFlux.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseMockFlux.java
index 206bd57229b8..569b992cdda9 100644
--- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseMockFlux.java
+++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseMockFlux.java
@@ -6,7 +6,7 @@
import com.azure.core.http.HttpHeaders;
import com.azure.core.http.HttpResponse;
import com.azure.storage.blob.APISpec;
-import com.azure.storage.blob.HTTPGetterInfo;
+import com.azure.storage.blob.HttpGetterInfo;
import com.azure.storage.blob.implementation.models.BlobsDownloadResponse;
import com.azure.storage.blob.models.BlobDownloadHeaders;
import com.azure.storage.blob.models.StorageErrorException;
@@ -30,7 +30,7 @@ class DownloadResponseMockFlux extends Flux {
private int scenario;
private int tryNumber;
- private HTTPGetterInfo info;
+ private HttpGetterInfo info;
private ByteBuffer scenarioData;
DownloadResponseMockFlux(int scenario, APISpec apiSpec) {
@@ -147,7 +147,7 @@ public void subscribe(CoreSubscriber super ByteBuffer> subscriber) {
}
}
- Mono getter(HTTPGetterInfo info) {
+ Mono getter(HttpGetterInfo info) {
this.tryNumber++;
this.info = info;
BlobsDownloadResponse rawResponse = new BlobsDownloadResponse(null, 200, new HttpHeaders(), this, new BlobDownloadHeaders());
diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseTest.groovy
index 46e78f85c301..b796956437e7 100644
--- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseTest.groovy
+++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/DownloadResponseTest.groovy
@@ -6,7 +6,7 @@ package com.azure.storage.blob.specialized
import com.azure.core.implementation.util.FluxUtil
import com.azure.storage.blob.APISpec
-import com.azure.storage.blob.HTTPGetterInfo
+import com.azure.storage.blob.HttpGetterInfo
import com.azure.storage.blob.models.ReliableDownloadOptions
import com.azure.storage.blob.models.StorageErrorException
import spock.lang.Unroll
@@ -36,7 +36,7 @@ class DownloadResponseTest extends APISpec {
setup:
DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario, this)
- HTTPGetterInfo info = new HTTPGetterInfo()
+ HttpGetterInfo info = new HttpGetterInfo()
.setOffset(0)
.setCount(flux.getScenarioData().remaining())
.setETag("etag")
@@ -63,7 +63,7 @@ class DownloadResponseTest extends APISpec {
setup:
DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario, this)
ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5)
- HTTPGetterInfo info = new HTTPGetterInfo().setETag("etag")
+ HttpGetterInfo info = new HttpGetterInfo().setETag("etag")
when:
DownloadAsyncResponse response = flux.getter(info).block()
@@ -94,7 +94,7 @@ class DownloadResponseTest extends APISpec {
DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK, this)
when:
- new DownloadAsyncResponse(flux.getter(info).block().getRawResponse(), info, { HTTPGetterInfo newInfo -> flux.getter(newInfo) })
+ new DownloadAsyncResponse(flux.getter(info).block().getRawResponse(), info, { HttpGetterInfo newInfo -> flux.getter(newInfo) })
then:
thrown(NullPointerException)
@@ -102,7 +102,7 @@ class DownloadResponseTest extends APISpec {
where:
info | _
null | _
- new HTTPGetterInfo().setETag(null) | _
+ new HttpGetterInfo().setETag(null) | _
}
def "Options IA"() {
@@ -118,8 +118,8 @@ class DownloadResponseTest extends APISpec {
DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK, this)
when:
- DownloadAsyncResponse response = new DownloadAsyncResponse(flux.getter(new HTTPGetterInfo()).block()
- .getRawResponse(), new HTTPGetterInfo().setETag("etag"), null)
+ DownloadAsyncResponse response = new DownloadAsyncResponse(flux.getter(new HttpGetterInfo()).block()
+ .getRawResponse(), new HttpGetterInfo().setETag("etag"), null)
response.body(null).blockFirst()
then:
@@ -129,7 +129,7 @@ class DownloadResponseTest extends APISpec {
def "Info"() {
setup:
DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_INFO_TEST, this)
- HTTPGetterInfo info = new HTTPGetterInfo()
+ HttpGetterInfo info = new HttpGetterInfo()
.setOffset(20)
.setCount(10)
.setETag("etag")
@@ -146,7 +146,7 @@ class DownloadResponseTest extends APISpec {
def "Info count IA"() {
when:
- new HTTPGetterInfo().setCount(-1)
+ new HttpGetterInfo().setCount(-1)
then:
thrown(IllegalArgumentException)
diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/HelperTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/HelperTest.groovy
index 81223787366b..047d236d35be 100644
--- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/HelperTest.groovy
+++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/HelperTest.groovy
@@ -5,17 +5,16 @@ package com.azure.storage.blob.specialized
import com.azure.storage.blob.APISpec
import com.azure.storage.blob.BlobSasPermission
-import com.azure.storage.blob.BlobURLParts
import com.azure.storage.blob.BlobContainerSasPermission
-
+import com.azure.storage.blob.BlobUrlParts
import com.azure.storage.blob.models.BlobRange
import com.azure.storage.blob.models.UserDelegationKey
-import com.azure.storage.common.AccountSASPermission
-import com.azure.storage.common.AccountSASResourceType
-import com.azure.storage.common.AccountSASSignatureValues
+import com.azure.storage.common.AccountSasPermission
+import com.azure.storage.common.AccountSasResourceType
+import com.azure.storage.common.AccountSasSignatureValues
import com.azure.storage.common.Constants
import com.azure.storage.common.IpRange
-import com.azure.storage.common.SASProtocol
+import com.azure.storage.common.SasProtocol
import com.azure.storage.common.Utility
import com.azure.storage.common.credentials.SharedKeyCredential
import spock.lang.Unroll
@@ -121,7 +120,7 @@ class HelperTest extends APISpec {
.setContentLanguage(language)
.setContentType(type)
- BlobServiceSasQueryParameters token = v.generateSASQueryParameters(primaryCredential)
+ BlobServiceSasQueryParameters token = v.generateSasQueryParameters(primaryCredential)
if (startTime != null) {
expectedStringToSign = String.format(expectedStringToSign,
@@ -149,10 +148,10 @@ class HelperTest extends APISpec {
null | OffsetDateTime.now(ZoneOffset.UTC).minusDays(1) | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | null | null | null | null | null || "\n%s\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n"
null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n"
null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | "id" | null | null | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\nid\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n"
- null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | new IpRange() | null | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\nip\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n"
- null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | SASProtocol.HTTPS_ONLY | null | null | null | null | null | null || "\n\n%s\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 | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | "snapId" | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\nsnapId\n\n\n\n\n"
- null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | "control" | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\ncontrol\n\n\n\n"
+ null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | new IpRange() | null | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\nip\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n"
+ null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | SasProtocol.HTTPS_ONLY | null | null | null | null | null | null || "\n\n%s\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 | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | "snapId" | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\nsnapId\n\n\n\n\n"
+ null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | "control" | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\ncontrol\n\n\n\n"
null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | null | "disposition" | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\ndisposition\n\n\n"
null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | null | null | "encoding" | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\nencoding\n\n"
null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | null | null | null | "language" | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\nlanguage\n"
@@ -205,7 +204,7 @@ class HelperTest extends APISpec {
.setSignedVersion(keyVersion)
.setValue(keyValue)
- BlobServiceSasQueryParameters token = v.generateSASQueryParameters(key)
+ BlobServiceSasQueryParameters token = v.generateSasQueryParameters(key)
expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(v.getExpiryTime()), primaryCredential.getAccountName())
@@ -226,9 +225,9 @@ class HelperTest extends APISpec {
null | null | 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 || "\n\n%s\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 | null | null | "b" | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "\n\n%s\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 | null | null | "2018-06-17" | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "\n\n%s\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 | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | new IpRange() | null | null | null | null | null | null | null || "\n\n%s\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 | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | SASProtocol.HTTPS_ONLY | null | null | null | null | null | null || "\n\n%s\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 | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | "snapId" | null | null | null | null | null || "\n\n%s\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 | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | new IpRange() | null | null | null | null | null | null | null || "\n\n%s\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 | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | SasProtocol.HTTPS_ONLY | null | null | null | null | null | null || "\n\n%s\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 | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | "snapId" | null | null | null | null | null || "\n\n%s\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 | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | "control" | null | null | null | null || "\n\n%s\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 | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | "disposition" | null | null | null || "\n\n%s\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 | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | "encoding" | null | null || "\n\n%s\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"
@@ -255,7 +254,7 @@ class HelperTest extends APISpec {
primaryCredential.getAccountName())
when:
- BlobServiceSasQueryParameters token = v.generateSASQueryParameters(primaryCredential)
+ BlobServiceSasQueryParameters token = v.generateSasQueryParameters(primaryCredential)
then:
token.getSignature() == primaryCredential.computeHmac256(expectedStringToSign)
@@ -281,7 +280,7 @@ class HelperTest extends APISpec {
.setVersion(version)
when:
- v.generateSASQueryParameters((SharedKeyCredential)creds)
+ v.generateSasQueryParameters((SharedKeyCredential)creds)
then:
def e = thrown(NullPointerException)
@@ -442,12 +441,12 @@ class HelperTest extends APISpec {
@Unroll
def "SASProtocol parse"() {
expect:
- SASProtocol.parse(protocolStr) == protocol
+ SasProtocol.parse(protocolStr) == protocol
where:
protocolStr || protocol
- "https" || SASProtocol.HTTPS_ONLY
- "https,http" || SASProtocol.HTTPS_HTTP
+ "https" || SasProtocol.HTTPS_ONLY
+ "https,http" || SasProtocol.HTTPS_HTTP
}
/*
@@ -459,8 +458,8 @@ class HelperTest extends APISpec {
@Unroll
def "accountSasSignatures string to sign"() {
when:
- AccountSASSignatureValues v = new AccountSASSignatureValues()
- .setPermissions(new AccountSASPermission().setReadPermission(true).toString())
+ AccountSasSignatureValues v = new AccountSasSignatureValues()
+ .setPermissions(new AccountSasPermission().setReadPermission(true).toString())
.setServices("b")
.setResourceTypes("o")
.setStartTime(startTime)
@@ -471,7 +470,7 @@ class HelperTest extends APISpec {
v.setIpRange(new IpRange().setIpMin("ip"))
}
- def token = v.generateSASQueryParameters(primaryCredential)
+ def token = v.generateSasQueryParameters(primaryCredential)
expectedStringToSign = String.format(expectedStringToSign, primaryCredential.getAccountName())
@@ -482,13 +481,13 @@ class HelperTest extends APISpec {
startTime | ipRange | protocol || expectedStringToSign
OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | null | null || "%s\nr\nb\no\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n"
null | new IpRange() | null || "%s\nr\nb\no\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\nip\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n"
- null | null | SASProtocol.HTTPS_ONLY || "%s\nr\nb\no\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n\n" + SASProtocol.HTTPS_ONLY + "\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n"
+ null | null | SasProtocol.HTTPS_ONLY || "%s\nr\nb\no\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n\n" + SasProtocol.HTTPS_ONLY + "\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n"
}
@Unroll
def "accountSasSignatureValues IA"() {
setup:
- AccountSASSignatureValues v = new AccountSASSignatureValues()
+ AccountSasSignatureValues v = new AccountSasSignatureValues()
.setPermissions(permissions)
.setServices(service)
.setResourceTypes(resourceType)
@@ -496,7 +495,7 @@ class HelperTest extends APISpec {
.setVersion(version)
when:
- v.generateSASQueryParameters(creds)
+ v.generateSasQueryParameters(creds)
then:
def e = thrown(NullPointerException)
@@ -515,7 +514,7 @@ class HelperTest extends APISpec {
@Unroll
def "AccountSASPermissions toString"() {
setup:
- AccountSASPermission perms = new AccountSASPermission()
+ AccountSasPermission perms = new AccountSasPermission()
.setReadPermission(read)
.setWritePermission(write)
.setDeletePermission(delete)
@@ -544,7 +543,7 @@ class HelperTest extends APISpec {
@Unroll
def "AccountSASPermissions parse"() {
when:
- AccountSASPermission perms = AccountSASPermission.parse(permString)
+ AccountSasPermission perms = AccountSasPermission.parse(permString)
then:
perms.getReadPermission() == read
@@ -572,7 +571,7 @@ class HelperTest extends APISpec {
def "AccountSASPermissions parse IA"() {
when:
- AccountSASPermission.parse("rwaq")
+ AccountSasPermission.parse("rwaq")
then:
thrown(IllegalArgumentException)
@@ -581,7 +580,7 @@ class HelperTest extends APISpec {
@Unroll
def "AccountSASResourceType toString"() {
setup:
- AccountSASResourceType resourceTypes = new AccountSASResourceType()
+ AccountSasResourceType resourceTypes = new AccountSasResourceType()
.setService(service)
.setContainer(container)
.setObject(object)
@@ -600,12 +599,12 @@ class HelperTest extends APISpec {
@Unroll
def "AccountSASResourceType parse"() {
when:
- AccountSASResourceType resourceTypes = AccountSASResourceType.parse(resourceTypeString)
+ AccountSasResourceType resourceTypes = AccountSasResourceType.parse(resourceTypeString)
then:
resourceTypes.isService() == service
resourceTypes.isContainer() == container
- resourceTypes.getObject() == object
+ resourceTypes.isObject() == object
where:
resourceTypeString || service | container | object
@@ -618,7 +617,7 @@ class HelperTest extends APISpec {
@Unroll
def "AccountSASResourceType IA"() {
when:
- AccountSASResourceType.parse("scq")
+ AccountSasResourceType.parse("scq")
then:
thrown(IllegalArgumentException)
@@ -626,7 +625,7 @@ class HelperTest extends APISpec {
def "BlobURLParts"() {
setup:
- BlobURLParts parts = new BlobURLParts()
+ BlobUrlParts parts = new BlobUrlParts()
.setScheme("http")
.setHost("host")
.setContainerName("container")
@@ -639,7 +638,7 @@ class HelperTest extends APISpec {
.setCanonicalName(String.format("/blob/%s/container/blob", primaryCredential.getAccountName()))
.setResource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT)
- parts.setSasQueryParameters(sasValues.generateSASQueryParameters(primaryCredential))
+ parts.setSasQueryParameters(sasValues.generateSasQueryParameters(primaryCredential))
when:
String[] splitParts = parts.toURL().toString().split("\\?")
@@ -655,7 +654,7 @@ class HelperTest extends APISpec {
def "URLParser"() {
when:
- BlobURLParts parts = BlobURLParts.parse(new URL("http://host/container/blob?snapshot=snapshot&sv=" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "&sr=c&sp=r&sig=Ee%2BSodSXamKSzivSdRTqYGh7AeMVEk3wEoRZ1yzkpSc%3D"))
+ BlobUrlParts parts = BlobUrlParts.parse(new URL("http://host/container/blob?snapshot=snapshot&sv=" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "&sr=c&sp=r&sig=Ee%2BSodSXamKSzivSdRTqYGh7AeMVEk3wEoRZ1yzkpSc%3D"))
then:
parts.getScheme() == "http"
diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASPermission.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasPermission.java
similarity index 83%
rename from sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASPermission.java
rename to sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasPermission.java
index 8e36fb8dbe88..28a5094758cf 100644
--- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASPermission.java
+++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasPermission.java
@@ -9,10 +9,10 @@
* This is a helper class to construct a string representing the permissions granted by an AccountSAS. 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 an {@link
- * AccountSASSignatureValues} object. It is possible to construct the permissions string without this class, but the
+ * AccountSasSignatureValues} object. It is possible to construct the permissions string without this class, but the
* order of the permissions is particular and this class guarantees correctness.
*/
-public final class AccountSASPermission {
+public final class AccountSasPermission {
private boolean readPermission;
@@ -31,22 +31,22 @@ public final class AccountSASPermission {
private boolean processMessagesPermission;
/**
- * Initializes an {@code AccountSASPermission} object with all fields set to false.
+ * Initializes an {@code AccountSasPermission} object with all fields set to false.
*/
- public AccountSASPermission() {
+ public AccountSasPermission() {
}
/**
- * Creates an {@code AccountSASPermission} from the specified permissions string. This method will throw an
+ * Creates an {@code AccountSasPermission} from the specified permissions string. This method will throw an
* {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission.
*
* @param permString A {@code String} which represents the {@code SharedAccessAccountPermissions}.
- * @return An {@code AccountSASPermission} object generated from the given {@code String}.
+ * @return An {@code AccountSasPermission} object generated from the given {@code String}.
* @throws IllegalArgumentException If {@code permString} contains a character other than r, w, d, l, a, c, u, or
* p.
*/
- public static AccountSASPermission parse(String permString) {
- AccountSASPermission permissions = new AccountSASPermission();
+ public static AccountSasPermission parse(String permString) {
+ AccountSasPermission permissions = new AccountSasPermission();
for (int i = 0; i < permString.length(); i++) {
char c = permString.charAt(i);
@@ -95,9 +95,9 @@ public boolean getReadPermission() {
* Sets the read permission status.
*
* @param hasReadPermission Permission status to set
- * @return the updated AccountSASPermission object
+ * @return the updated AccountSasPermission object
*/
- public AccountSASPermission setReadPermission(boolean hasReadPermission) {
+ public AccountSasPermission setReadPermission(boolean hasReadPermission) {
this.readPermission = hasReadPermission;
return this;
}
@@ -113,9 +113,9 @@ public boolean getAddPermission() {
* Sets the add permission status.
*
* @param hadAddPermission Permission status to set
- * @return the updated AccountSASPermission object
+ * @return the updated AccountSasPermission object
*/
- public AccountSASPermission setAddPermission(boolean hadAddPermission) {
+ public AccountSasPermission setAddPermission(boolean hadAddPermission) {
this.addPermission = hadAddPermission;
return this;
}
@@ -131,9 +131,9 @@ public boolean getCreatePermission() {
* Sets the create permission status.
*
* @param hasCreatePermission Permission status to set
- * @return the updated AccountSASPermission object
+ * @return the updated AccountSasPermission object
*/
- public AccountSASPermission setCreatePermission(boolean hasCreatePermission) {
+ public AccountSasPermission setCreatePermission(boolean hasCreatePermission) {
this.createPermission = hasCreatePermission;
return this;
}
@@ -149,9 +149,9 @@ public boolean getWritePermission() {
* Sets the write permission status.
*
* @param hasWritePermission Permission status to set
- * @return the updated AccountSASPermission object
+ * @return the updated AccountSasPermission object
*/
- public AccountSASPermission setWritePermission(boolean hasWritePermission) {
+ public AccountSasPermission setWritePermission(boolean hasWritePermission) {
this.writePermission = hasWritePermission;
return this;
}
@@ -167,9 +167,9 @@ public boolean getDeletePermission() {
* Sets the delete permission status.
*
* @param hasDeletePermission Permission status to set
- * @return the updated AccountSASPermission object
+ * @return the updated AccountSasPermission object
*/
- public AccountSASPermission setDeletePermission(boolean hasDeletePermission) {
+ public AccountSasPermission setDeletePermission(boolean hasDeletePermission) {
this.deletePermission = hasDeletePermission;
return this;
}
@@ -186,9 +186,9 @@ public boolean getListPermission() {
* directories, and files.
*
* @param hadListPermission Permission status to set
- * @return the updated AccountSASPermission object
+ * @return the updated AccountSasPermission object
*/
- public AccountSASPermission setListPermission(boolean hadListPermission) {
+ public AccountSasPermission setListPermission(boolean hadListPermission) {
this.listPermission = hadListPermission;
return this;
}
@@ -206,9 +206,9 @@ public boolean getUpdatePermission() {
* Sets the update permission status, it allows the update of queue messages and tables.
*
* @param hasUpdatePermission Permission status to set
- * @return the updated AccountSASPermission object
+ * @return the updated AccountSasPermission object
*/
- public AccountSASPermission setUpdatePermission(boolean hasUpdatePermission) {
+ public AccountSasPermission setUpdatePermission(boolean hasUpdatePermission) {
this.updatePermission = hasUpdatePermission;
return this;
}
@@ -226,9 +226,9 @@ public boolean getProcessMessages() {
* Sets the process messages permission, this allows the retrieval and deletion of queue messages.
*
* @param hasProcessMessagesPermission Permission status to set
- * @return the updated AccountSASPermission object
+ * @return the updated AccountSasPermission object
*/
- public AccountSASPermission setProcessMessages(boolean hasProcessMessagesPermission) {
+ public AccountSasPermission setProcessMessages(boolean hasProcessMessagesPermission) {
this.processMessagesPermission = hasProcessMessagesPermission;
return this;
}
diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasQueryParameters.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasQueryParameters.java
index 11f727c7ae3b..73355240ac31 100644
--- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasQueryParameters.java
+++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasQueryParameters.java
@@ -8,7 +8,7 @@
/**
* 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 {@link AccountSASSignatureValues} type. Once generated, it can be set on a
+ * by the user; it is only generated by the {@link AccountSasSignatureValues} type. Once generated, it can be set on a
* ServiceClientBuilder 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
@@ -51,7 +51,7 @@ public AccountSasQueryParameters(Map queryParamsMap, boolean r
* @param permissions A {@code String} representing the storage permissions or {@code null}.
* @param signature A {@code String} representing the signature for the SAS token.
*/
- AccountSasQueryParameters(String version, String services, String resourceTypes, SASProtocol protocol,
+ AccountSasQueryParameters(String version, String services, String resourceTypes, SasProtocol protocol,
OffsetDateTime startTime, OffsetDateTime expiryTime, IpRange ipRange,
String permissions, String signature) {
super(version, protocol, startTime, expiryTime, ipRange, permissions, signature);
@@ -60,7 +60,7 @@ public AccountSasQueryParameters(Map queryParamsMap, boolean r
}
/**
- * @return The storage services being accessed (only for Account SAS). Please refer to {@link AccountSASService} for
+ * @return The storage services being accessed (only for Account SAS). Please refer to {@link AccountSasService} for
* more details.
*/
public String getServices() {
@@ -69,7 +69,7 @@ public String getServices() {
/**
* @return The storage resource types being accessed (only for Account SAS). Please refer to {@link
- * AccountSASResourceType} for more details.
+ * AccountSasResourceType} for more details.
*/
public String getResourceTypes() {
return resourceTypes;
diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASResourceType.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasResourceType.java
similarity index 82%
rename from sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASResourceType.java
rename to sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasResourceType.java
index e8c7df1119ee..e4490618f93c 100644
--- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASResourceType.java
+++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasResourceType.java
@@ -9,10 +9,10 @@
* This is a helper class to construct a string representing the resources accessible by an AccountSAS. Setting a value
* to true means that any SAS which uses these permissions will grant access to that resource type. Once all the values
* are set, this should be serialized with toString and set as the resources field on an {@link
- * AccountSASSignatureValues} object. It is possible to construct the resources string without this class, but the order
+ * AccountSasSignatureValues} object. It is possible to construct the resources string without this class, but the order
* of the resources is particular and this class guarantees correctness.
*/
-public final class AccountSASResourceType {
+public final class AccountSasResourceType {
private boolean service;
@@ -21,21 +21,21 @@ public final class AccountSASResourceType {
private boolean object;
/**
- * Initializes an {@code AccountSASResourceType} object with all fields set to false.
+ * Initializes an {@code AccountSasResourceType} object with all fields set to false.
*/
- public AccountSASResourceType() {
+ public AccountSasResourceType() {
}
/**
- * Creates an {@code AccountSASResourceType} from the specified resource types string. This method will throw an
+ * Creates an {@code AccountSasResourceType} from the specified resource types string. This method will throw an
* {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid resource type.
*
* @param resourceTypesString A {@code String} which represents the {@code AccountSASResourceTypes}.
- * @return A {@code AccountSASResourceType} generated from the given {@code String}.
+ * @return A {@code AccountSasResourceType} generated from the given {@code String}.
* @throws IllegalArgumentException If {@code resourceTypesString} contains a character other than s, c, or o.
*/
- public static AccountSASResourceType parse(String resourceTypesString) {
- AccountSASResourceType resourceType = new AccountSASResourceType();
+ public static AccountSasResourceType parse(String resourceTypesString) {
+ AccountSasResourceType resourceType = new AccountSasResourceType();
for (int i = 0; i < resourceTypesString.length(); i++) {
char c = resourceTypesString.charAt(i);
@@ -69,9 +69,9 @@ public boolean isService() {
* Sets the access status for service level APIs.
*
* @param service Access status to set
- * @return the updated AccountSASResourceType object.
+ * @return the updated AccountSasResourceType object.
*/
- public AccountSASResourceType setService(boolean service) {
+ public AccountSasResourceType setService(boolean service) {
this.service = service;
return this;
}
@@ -89,9 +89,9 @@ public boolean isContainer() {
* Shares.
*
* @param container Access status to set
- * @return the updated AccountSASResourceType object.
+ * @return the updated AccountSasResourceType object.
*/
- public AccountSASResourceType setContainer(boolean container) {
+ public AccountSasResourceType setContainer(boolean container) {
this.container = container;
return this;
}
@@ -100,7 +100,7 @@ public AccountSASResourceType setContainer(boolean container) {
* @return the access status for object level APIs, this grants access to Blobs, Table Entities, Queue Messages,
* Files.
*/
- public boolean getObject() {
+ public boolean isObject() {
return object;
}
@@ -109,9 +109,9 @@ public boolean getObject() {
* Files.
*
* @param object Access status to set
- * @return the updated AccountSASResourceType object.
+ * @return the updated AccountSasResourceType object.
*/
- public AccountSASResourceType setObject(boolean object) {
+ public AccountSasResourceType setObject(boolean object) {
this.object = object;
return this;
}
diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASService.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasService.java
similarity index 82%
rename from sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASService.java
rename to sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasService.java
index 57c7351047f5..997b2e2da6a6 100644
--- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASService.java
+++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasService.java
@@ -9,10 +9,10 @@
* This is a helper class to construct a string representing the services accessible by an AccountSAS. Setting a value
* to true means that any SAS which uses these permissions will grant access to that service. Once all the
* values are set, this should be serialized with toString and set as the services field on an
- * {@link AccountSASSignatureValues} object. It is possible to construct the services string without this class, but
+ * {@link AccountSasSignatureValues} object. It is possible to construct the services string without this class, but
* the order of the services is particular and this class guarantees correctness.
*/
-public final class AccountSASService {
+public final class AccountSasService {
private boolean blob;
@@ -23,22 +23,22 @@ public final class AccountSASService {
private boolean table;
/**
- * Initializes an {@code AccountSASService} object with all fields set to false.
+ * Initializes an {@code AccountSasService} object with all fields set to false.
*/
- public AccountSASService() {
+ public AccountSasService() {
}
/**
- * Creates an {@code AccountSASService} from the specified services string. This method will throw an
+ * Creates an {@code AccountSasService} from the specified services string. This method will throw an
* {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid service.
*
* @param servicesString A {@code String} which represents the {@code SharedAccessAccountServices}.
*
- * @return A {@code AccountSASService} generated from the given {@code String}.
+ * @return A {@code AccountSasService} generated from the given {@code String}.
* @throws IllegalArgumentException If {@code servicesString} contains a character other than b, f, q, or t.
*/
- public static AccountSASService parse(String servicesString) {
- AccountSASService services = new AccountSASService();
+ public static AccountSasService parse(String servicesString) {
+ AccountSasService services = new AccountSasService();
for (int i = 0; i < servicesString.length(); i++) {
char c = servicesString.charAt(i);
@@ -75,9 +75,9 @@ public boolean isBlob() {
* Sets the access status for blob resources.
*
* @param blob Access status to set
- * @return the updated AccountSASService object.
+ * @return the updated AccountSasService object.
*/
- public AccountSASService setBlob(boolean blob) {
+ public AccountSasService setBlob(boolean blob) {
this.blob = blob;
return this;
}
@@ -93,9 +93,9 @@ public boolean isFile() {
* Sets the access status for file resources.
*
* @param file Access status to set
- * @return the updated AccountSASService object.
+ * @return the updated AccountSasService object.
*/
- public AccountSASService setFile(boolean file) {
+ public AccountSasService setFile(boolean file) {
this.file = file;
return this;
}
@@ -111,9 +111,9 @@ public boolean isQueue() {
* Sets the access status for queue resources.
*
* @param queue Access status to set
- * @return the updated AccountSASService object.
+ * @return the updated AccountSasService object.
*/
- public AccountSASService setQueue(boolean queue) {
+ public AccountSasService setQueue(boolean queue) {
this.queue = queue;
return this;
}
@@ -129,9 +129,9 @@ public boolean isTable() {
* Sets the access status for table resources.
*
* @param table Access status to set
- * @return the updated AccountSASService object.
+ * @return the updated AccountSasService object.
*/
- public AccountSASService setTable(boolean table) {
+ public AccountSasService setTable(boolean table) {
this.table = table;
return this;
}
diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASSignatureValues.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasSignatureValues.java
similarity index 77%
rename from sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASSignatureValues.java
rename to sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasSignatureValues.java
index c8b6fa5fad49..0ae8b168fdb2 100644
--- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASSignatureValues.java
+++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSasSignatureValues.java
@@ -8,7 +8,7 @@
import java.time.OffsetDateTime;
/**
- * AccountSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. Once all
+ * AccountSasSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. Once all
* the values here are set appropriately, call generateSASQueryParameters to obtain a representation of the SAS which
* can actually be applied to blob urls. Note: that both this class and {@link AccountSasQueryParameters} exist because
* the former is mutable and a logical representation while the latter is immutable and used to generate actual REST
@@ -27,11 +27,11 @@
* here
* for additional samples.
*/
-public final class AccountSASSignatureValues {
+public final class AccountSasSignatureValues {
private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- private SASProtocol protocol;
+ private SasProtocol protocol;
private OffsetDateTime startTime;
@@ -46,34 +46,34 @@ public final class AccountSASSignatureValues {
private String resourceTypes;
/**
- * Initializes an {@code AccountSASSignatureValues} object with the version number set to the default and all other
+ * Initializes an {@code AccountSasSignatureValues} object with the version number set to the default and all other
* values empty.
*/
- public AccountSASSignatureValues() {
+ public AccountSasSignatureValues() {
}
/**
* Shared method between service clients to generate an account SAS.
*
* @param sharedKeyCredential The {@code SharedKeyCredential} shared key credential for the account SAS
- * @param accountSASService The {@code AccountSASService} services for the account SAS
- * @param accountSASResourceType An optional {@code AccountSASResourceType} resources for the account SAS
- * @param accountSASPermission The {@code AccountSASPermission} permission for the account SAS
+ * @param accountSASService The {@code AccountSasService} services for the account SAS
+ * @param accountSASResourceType An optional {@code AccountSasResourceType} resources for the account SAS
+ * @param accountSASPermission The {@code AccountSasPermission} permission for the account SAS
* @param expiryTime The {@code OffsetDateTime} expiry time for the account SAS
* @param startTime The {@code OffsetDateTime} start time for the account SAS
* @param version The {@code String} version for the account SAS
* @param ipRange An optional {@code IpRange} ip address range for the SAS
- * @param sasProtocol An optional {@code SASProtocol} protocol for the SAS
+ * @param sasProtocol An optional {@code SasProtocol} protocol for the SAS
* @return A string that represents the SAS token
* @throws NullPointerException If any of {@code sharedKeyCredentials}, {@code services}, {@code resourceTypes},
* {@code expiryTime}, {@code permissions} or {@code versions} is null
*/
- public static String generateAccountSAS(SharedKeyCredential sharedKeyCredential, AccountSASService
- accountSASService, AccountSASResourceType accountSASResourceType, AccountSASPermission accountSASPermission,
+ public static String generateAccountSas(SharedKeyCredential sharedKeyCredential, AccountSasService
+ accountSASService, AccountSasResourceType accountSASResourceType, AccountSasPermission accountSASPermission,
OffsetDateTime expiryTime, OffsetDateTime startTime, String version,
- IpRange ipRange, SASProtocol sasProtocol) {
+ IpRange ipRange, SasProtocol sasProtocol) {
- AccountSASSignatureValues values = new AccountSASSignatureValues();
+ AccountSasSignatureValues values = new AccountSasSignatureValues();
values.setServices(accountSASService == null ? null : accountSASService.toString());
values.setResourceTypes(accountSASResourceType == null ? null : accountSASResourceType.toString());
@@ -88,7 +88,7 @@ public static String generateAccountSAS(SharedKeyCredential sharedKeyCredential,
values.setIpRange(ipRange);
values.setProtocol(sasProtocol);
- AccountSasQueryParameters sasQueryParameters = values.generateSASQueryParameters(sharedKeyCredential);
+ AccountSasQueryParameters sasQueryParameters = values.generateSasQueryParameters(sharedKeyCredential);
return sasQueryParameters.encode();
}
@@ -106,27 +106,27 @@ public String getVersion() {
* library.
*
* @param version Target version to set
- * @return the updated AccountSASSignatureValues object.
+ * @return the updated AccountSasSignatureValues object.
*/
- public AccountSASSignatureValues setVersion(String version) {
+ public AccountSasSignatureValues setVersion(String version) {
this.version = version;
return this;
}
/**
- * @return the {@link SASProtocol} which determines the HTTP protocol that will be used.
+ * @return the {@link SasProtocol} which determines the HTTP protocol that will be used.
*/
- public SASProtocol getProtocol() {
+ public SasProtocol getProtocol() {
return protocol;
}
/**
- * Sets the {@link SASProtocol} which determines the HTTP protocol that will be used.
+ * Sets the {@link SasProtocol} which determines the HTTP protocol that will be used.
*
* @param protocol Protocol to set
- * @return the updated AccountSASSignatureValues object.
+ * @return the updated AccountSasSignatureValues object.
*/
- public AccountSASSignatureValues setProtocol(SASProtocol protocol) {
+ public AccountSasSignatureValues setProtocol(SasProtocol protocol) {
this.protocol = protocol;
return this;
}
@@ -142,9 +142,9 @@ public OffsetDateTime getStartTime() {
* Sets when the SAS will take effect.
*
* @param startTime Start time to set
- * @return the updated AccountSASSignatureValues object.
+ * @return the updated AccountSasSignatureValues object.
*/
- public AccountSASSignatureValues setStartTime(OffsetDateTime startTime) {
+ public AccountSasSignatureValues setStartTime(OffsetDateTime startTime) {
this.startTime = startTime;
return this;
}
@@ -160,15 +160,15 @@ public OffsetDateTime getExpiryTime() {
* Sets the time after which the SAS will no longer work.
*
* @param expiryTime Expiry time to set
- * @return the updated AccountSASSignatureValues object.
+ * @return the updated AccountSasSignatureValues object.
*/
- public AccountSASSignatureValues setExpiryTime(OffsetDateTime expiryTime) {
+ public AccountSasSignatureValues setExpiryTime(OffsetDateTime expiryTime) {
this.expiryTime = expiryTime;
return this;
}
/**
- * @return the operations the SAS user may perform. Please refer to {@link AccountSASPermission} to help determine
+ * @return the operations the SAS user may perform. Please refer to {@link AccountSasPermission} to help determine
* which permissions are allowed.
*/
public String getPermissions() {
@@ -176,13 +176,13 @@ public String getPermissions() {
}
/**
- * Sets the operations the SAS user may perform. Please refer to {@link AccountSASPermission} for help constructing
+ * Sets the operations the SAS user may perform. Please refer to {@link AccountSasPermission} for help constructing
* the permissions string.
*
* @param permissions Permissions string to set
- * @return the updated AccountSASSignatureValues object.
+ * @return the updated AccountSasSignatureValues object.
*/
- public AccountSASSignatureValues setPermissions(String permissions) {
+ public AccountSasSignatureValues setPermissions(String permissions) {
this.permissions = permissions;
return this;
}
@@ -198,15 +198,15 @@ public IpRange getIpRange() {
* Sets the {@link IpRange} which determines the IP ranges that are allowed to use the SAS.
*
* @param ipRange Allowed IP range to set
- * @return the updated AccountSASSignatureValues object.
+ * @return the updated AccountSasSignatureValues object.
*/
- public AccountSASSignatureValues setIpRange(IpRange ipRange) {
+ public AccountSasSignatureValues setIpRange(IpRange ipRange) {
this.ipRange = ipRange;
return this;
}
/**
- * @return the services accessible with this SAS. Please refer to {@link AccountSASService} to help determine which
+ * @return the services accessible with this SAS. Please refer to {@link AccountSasService} to help determine which
* services are accessible.
*/
public String getServices() {
@@ -214,18 +214,18 @@ public String getServices() {
}
/**
- * Sets the services accessible with this SAS. Please refer to {@link AccountSASService} to construct this value.
+ * Sets the services accessible with this SAS. Please refer to {@link AccountSasService} to construct this value.
*
* @param services Allowed services string to set
- * @return the updated AccountSASSignatureValues object.
+ * @return the updated AccountSasSignatureValues object.
*/
- public AccountSASSignatureValues setServices(String services) {
+ public AccountSasSignatureValues setServices(String services) {
this.services = services;
return this;
}
/**
- * @return the resource types accessible with this SAS. Please refer to {@link AccountSASResourceType} to help
+ * @return the resource types accessible with this SAS. Please refer to {@link AccountSasResourceType} to help
* determine the resource types that are accessible.
*/
public String getResourceTypes() {
@@ -233,13 +233,13 @@ public String getResourceTypes() {
}
/**
- * Sets the resource types accessible with this SAS. Please refer to {@link AccountSASResourceType} to construct
+ * Sets the resource types accessible with this SAS. Please refer to {@link AccountSasResourceType} to construct
* this value.
*
* @param resourceTypes Allowed resource types string to set
- * @return the updated AccountSASSignatureValues object.
+ * @return the updated AccountSasSignatureValues object.
*/
- public AccountSASSignatureValues setResourceTypes(String resourceTypes) {
+ public AccountSasSignatureValues setResourceTypes(String resourceTypes) {
this.resourceTypes = resourceTypes;
return this;
}
@@ -254,7 +254,7 @@ public AccountSASSignatureValues setResourceTypes(String resourceTypes) {
* @throws NullPointerException If any of {@code sharedKeyCredentials}, {@code services}, {@code resourceTypes},
* {@code expiryTime}, {@code permissions} or {@code versions} is null
*/
- public AccountSasQueryParameters generateSASQueryParameters(SharedKeyCredential sharedKeyCredentials) {
+ public AccountSasQueryParameters generateSasQueryParameters(SharedKeyCredential sharedKeyCredentials) {
Utility.assertNotNull("SharedKeyCredential", sharedKeyCredentials);
Utility.assertNotNull("services", this.services);
Utility.assertNotNull("resourceTypes", this.resourceTypes);
@@ -272,7 +272,7 @@ public AccountSasQueryParameters generateSASQueryParameters(SharedKeyCredential
private String stringToSign(final SharedKeyCredential sharedKeyCredentials) {
return String.join("\n",
sharedKeyCredentials.getAccountName(),
- AccountSASPermission.parse(this.permissions).toString(), // guarantees ordering
+ AccountSasPermission.parse(this.permissions).toString(), // guarantees ordering
this.services,
resourceTypes,
this.startTime == null ? Constants.EMPTY_STRING
diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/BaseSasQueryParameters.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/BaseSasQueryParameters.java
index bd0b280f1c5d..9b0f8ad52a00 100644
--- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/BaseSasQueryParameters.java
+++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/BaseSasQueryParameters.java
@@ -18,7 +18,7 @@ public abstract class BaseSasQueryParameters {
protected String version;
- protected SASProtocol protocol;
+ protected SasProtocol protocol;
protected OffsetDateTime startTime;
@@ -41,7 +41,7 @@ public BaseSasQueryParameters(Map queryParamsMap, boolean remo
this.version = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SERVICE_VERSION,
removeSASParametersFromMap);
this.protocol = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_PROTOCOL,
- removeSASParametersFromMap, SASProtocol::parse);
+ removeSASParametersFromMap, SasProtocol::parse);
this.startTime = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_START_TIME,
removeSASParametersFromMap, Utility::parseDate);
this.expiryTime = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_EXPIRY_TIME,
@@ -103,7 +103,7 @@ protected T getQueryParameter(Map parameters, String name,
* @param permissions A {@code String} representing the storage permissions or {@code null}.
* @param signature A {@code String} representing the signature for the SAS token.
*/
- public BaseSasQueryParameters(String version, SASProtocol protocol, OffsetDateTime startTime,
+ public BaseSasQueryParameters(String version, SasProtocol protocol, OffsetDateTime startTime,
OffsetDateTime expiryTime, IpRange ipRange, String permissions, String signature) {
this.version = version;
this.protocol = protocol;
@@ -122,9 +122,9 @@ public String getVersion() {
}
/**
- * @return The allowed HTTP protocol(s) or {@code null}. Please refer to {@link SASProtocol} for more details.
+ * @return The allowed HTTP protocol(s) or {@code null}. Please refer to {@link SasProtocol} for more details.
*/
- public SASProtocol getProtocol() {
+ public SasProtocol getProtocol() {
return protocol;
}
diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/SASProtocol.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/SasProtocol.java
similarity index 77%
rename from sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/SASProtocol.java
rename to sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/SasProtocol.java
index 68c3a6282452..50c35db317f0 100644
--- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/SASProtocol.java
+++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/SasProtocol.java
@@ -8,7 +8,7 @@
/**
* Specifies the set of possible permissions for a shared access signature protocol.
*/
-public enum SASProtocol {
+public enum SasProtocol {
/**
* Permission to use SAS only through https granted.
*/
@@ -21,7 +21,7 @@ public enum SASProtocol {
private final String protocols;
- SASProtocol(String p) {
+ SasProtocol(String p) {
this.protocols = p;
}
@@ -30,17 +30,17 @@ public enum SASProtocol {
*
* @param str The value to try to parse.
*
- * @return A {@code SASProtocol} value that represents the string if possible.
+ * @return A {@code SasProtocol} value that represents the string if possible.
* @throws IllegalArgumentException If {@code str} doesn't equal "https" or "https,http"
*/
- public static SASProtocol parse(String str) {
+ public static SasProtocol parse(String str) {
if (str.equals(Constants.HTTPS)) {
- return SASProtocol.HTTPS_ONLY;
+ return SasProtocol.HTTPS_ONLY;
} else if (str.equals(Constants.HTTPS_HTTP)) {
- return SASProtocol.HTTPS_HTTP;
+ return SasProtocol.HTTPS_HTTP;
}
throw new IllegalArgumentException(String.format(Locale.ROOT,
- "%s could not be parsed into a SASProtocol value.", str));
+ "%s could not be parsed into a SasProtocol value.", str));
}
@Override
diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/credentials/SasTokenCredential.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/credentials/SasTokenCredential.java
index 6c5d6cf377c7..74be7e4bf9e4 100644
--- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/credentials/SasTokenCredential.java
+++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/credentials/SasTokenCredential.java
@@ -59,7 +59,7 @@ public static SasTokenCredential fromSasTokenString(String sasToken) {
*
* Code Samples
*
- * {@codesnippet com.azure.storage.common.credentials.SASTokenCredential.fromQueryParameters#Map}
+ * {@codesnippet com.azure.storage.common.credentials.SasTokenCredential.fromQueryParameters#Map}
*
* @param queryParameters URL query parameters
* @return a SAS token credential if {@code queryParameters} is not {@code null} and has
diff --git a/sdk/storage/azure-storage-common/src/samples/java/com/azure/storage/common/credentials/SASTokenCredentialJavaDocCodeSnippets.java b/sdk/storage/azure-storage-common/src/samples/java/com/azure/storage/common/credentials/SASTokenCredentialJavaDocCodeSnippets.java
new file mode 100644
index 000000000000..2988a14cbd4b
--- /dev/null
+++ b/sdk/storage/azure-storage-common/src/samples/java/com/azure/storage/common/credentials/SASTokenCredentialJavaDocCodeSnippets.java
@@ -0,0 +1,44 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.storage.common.credentials;
+
+import com.azure.storage.common.Utility;
+
+import com.azure.storage.common.implementation.credentials.SasTokenCredential;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+
+/**
+ * Code snippets for {@link SasTokenCredential}.
+ */
+public final class SASTokenCredentialJavaDocCodeSnippets {
+ private final URL url = new URL("https://www.example.com?queryString");
+
+ /**
+ * @throws MalformedURLException ignored
+ */
+ public SASTokenCredentialJavaDocCodeSnippets() throws MalformedURLException {
+ }
+
+ /**
+ * Code sample for {@link SasTokenCredential#fromSasTokenString(String)}.
+ */
+ public void fromSASTokenString() {
+ String preformattedSASToken = "sasToken";
+ // BEGIN: com.azure.storage.common.credentials.SasTokenCredential.fromSasTokenString#String
+ SasTokenCredential credential = SasTokenCredential.fromSasTokenString(preformattedSASToken);
+ // END: com.azure.storage.common.credentials.SasTokenCredential.fromSasTokenString#String
+ }
+
+ /**
+ * Code sample for {@link SasTokenCredential#fromQueryParameters(Map)}.
+ */
+ public void fromQueryParameters() {
+ // BEGIN: com.azure.storage.common.credentials.SasTokenCredential.fromQueryParameters#Map
+ SasTokenCredential credential = SasTokenCredential
+ .fromQueryParameters(Utility.parseQueryString(url.getQuery()));
+ // END: com.azure.storage.common.credentials.SasTokenCredential.fromQueryParameters#Map
+ }
+}
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java
index 6af096fe948d..6ada93636d9f 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileAsyncClient.java
@@ -3,6 +3,10 @@
package com.azure.storage.file;
+import static com.azure.core.implementation.util.FluxUtil.withContext;
+import static com.azure.storage.file.FileExtensions.filePermissionAndKeyHelper;
+import static com.azure.storage.file.PostProcessor.postProcessResponse;
+
import com.azure.core.annotation.ServiceClient;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.rest.PagedFlux;
@@ -40,11 +44,6 @@
import com.azure.storage.file.models.FileUploadRangeFromUrlInfo;
import com.azure.storage.file.models.HandleItem;
import com.azure.storage.file.models.StorageException;
-import reactor.core.Exceptions;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-import reactor.core.scheduler.Schedulers;
-
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
@@ -65,10 +64,10 @@
import java.util.concurrent.TimeoutException;
import java.util.function.Function;
import java.util.stream.Collectors;
-
-import static com.azure.core.implementation.util.FluxUtil.withContext;
-import static com.azure.storage.file.FileExtensions.filePermissionAndKeyHelper;
-import static com.azure.storage.file.PostProcessor.postProcessResponse;
+import reactor.core.Exceptions;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
/**
* This class provides a client that contains all the operations for interacting with file in Azure Storage File
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java
index 65facb96362c..6bb90ad5bf51 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileClient.java
@@ -20,14 +20,13 @@
import com.azure.storage.file.models.FileUploadRangeFromUrlInfo;
import com.azure.storage.file.models.HandleItem;
import com.azure.storage.file.models.StorageException;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-
import java.net.URI;
import java.nio.ByteBuffer;
import java.nio.file.FileAlreadyExistsException;
import java.time.Duration;
import java.util.Map;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
/**
* This class provides a client that contains all the operations for interacting files under Azure Storage File Service.
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java
index f6b016f8acfc..1a7e1cc29673 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java
@@ -3,6 +3,9 @@
package com.azure.storage.file;
+import static com.azure.core.implementation.util.FluxUtil.withContext;
+import static com.azure.storage.file.PostProcessor.postProcessResponse;
+
import com.azure.core.annotation.ServiceClient;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedResponse;
@@ -23,16 +26,12 @@
import com.azure.storage.file.models.ListSharesOptions;
import com.azure.storage.file.models.ShareItem;
import com.azure.storage.file.models.StorageException;
-import reactor.core.publisher.Mono;
-
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
-
-import static com.azure.core.implementation.util.FluxUtil.withContext;
-import static com.azure.storage.file.PostProcessor.postProcessResponse;
+import reactor.core.publisher.Mono;
/**
* This class provides a azureFileStorageClient that contains all the operations for interacting with a file account in
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java
index 0f0e2448b640..ae4533dd8c85 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceClient.java
@@ -15,10 +15,9 @@
import com.azure.storage.file.models.ListSharesOptions;
import com.azure.storage.file.models.ShareItem;
import com.azure.storage.file.models.StorageException;
-import reactor.core.publisher.Mono;
-
import java.time.Duration;
import java.util.Map;
+import reactor.core.publisher.Mono;
/**
* This class provides a fileServiceAsyncClient that contains all the operations for interacting with a file account in
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSasQueryParameters.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSasQueryParameters.java
index 4d2be37d8f71..70abcc02ccb2 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSasQueryParameters.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSasQueryParameters.java
@@ -6,7 +6,7 @@
import com.azure.storage.common.BaseSasQueryParameters;
import com.azure.storage.common.Constants;
import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
+import com.azure.storage.common.SasProtocol;
import java.time.OffsetDateTime;
import java.util.Map;
@@ -75,7 +75,7 @@ public FileServiceSasQueryParameters(Map queryParamsMap, boole
* @param permissions A {@code String} representing the storage permissions or {@code null}.
* @param signature A {@code String} representing the signature for the SAS token.
*/
- FileServiceSasQueryParameters(String version, SASProtocol protocol, OffsetDateTime startTime,
+ FileServiceSasQueryParameters(String version, SasProtocol protocol, OffsetDateTime startTime,
OffsetDateTime expiryTime, IpRange ipRange, String identifier, String resource, String permissions,
String signature, String cacheControl, String contentDisposition, String contentEncoding,
String contentLanguage, String contentType) {
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSasSignatureValues.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSasSignatureValues.java
index 4ff46fcff2ac..942a58cc8717 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSasSignatureValues.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/FileServiceSasSignatureValues.java
@@ -5,7 +5,7 @@
import com.azure.storage.common.Constants;
import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
+import com.azure.storage.common.SasProtocol;
import com.azure.storage.common.Utility;
import com.azure.storage.common.credentials.SharedKeyCredential;
@@ -32,7 +32,7 @@ public final class FileServiceSasSignatureValues {
private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- private SASProtocol protocol;
+ private SasProtocol protocol;
private OffsetDateTime startTime;
@@ -84,7 +84,7 @@ public final class FileServiceSasSignatureValues {
this.identifier = identifier;
}
- FileServiceSasSignatureValues(String version, SASProtocol sasProtocol, OffsetDateTime startTime,
+ FileServiceSasSignatureValues(String version, SasProtocol sasProtocol, OffsetDateTime startTime,
OffsetDateTime expiryTime, String permission, IpRange ipRange, String identifier, String cacheControl,
String contentDisposition, String contentEncoding, String contentLanguage, String contentType) {
if (version != null) {
@@ -124,19 +124,19 @@ public FileServiceSasSignatureValues setVersion(String version) {
}
/**
- * @return the {@link SASProtocol} which determines the protocols allowed by the SAS.
+ * @return the {@link SasProtocol} which determines the protocols allowed by the SAS.
*/
- public SASProtocol getProtocol() {
+ public SasProtocol getProtocol() {
return protocol;
}
/**
- * Sets the {@link SASProtocol} which determines the protocols allowed by the SAS.
+ * Sets the {@link SasProtocol} which determines the protocols allowed by the SAS.
*
* @param protocol Protocol for the SAS
* @return the updated FileServiceSasSignatureValues object
*/
- public FileServiceSasSignatureValues setProtocol(SASProtocol protocol) {
+ public FileServiceSasSignatureValues setProtocol(SasProtocol protocol) {
this.protocol = protocol;
return this;
}
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java
index e07cb6e6749d..e01c814eb893 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareAsyncClient.java
@@ -3,6 +3,9 @@
package com.azure.storage.file;
+import static com.azure.core.implementation.util.FluxUtil.withContext;
+import static com.azure.storage.file.PostProcessor.postProcessResponse;
+
import com.azure.core.annotation.ServiceClient;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.rest.PagedFlux;
@@ -29,17 +32,13 @@
import com.azure.storage.file.models.ShareStatistics;
import com.azure.storage.file.models.SignedIdentifier;
import com.azure.storage.file.models.StorageException;
-import reactor.core.publisher.Mono;
-
import java.time.OffsetDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
-
-import static com.azure.core.implementation.util.FluxUtil.withContext;
-import static com.azure.storage.file.PostProcessor.postProcessResponse;
+import reactor.core.publisher.Mono;
/**
* This class provides a azureFileStorageClient that contains all the operations for interacting with a share in Azure
diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java
index c1ce43c3600d..dfcbe1e07c7d 100644
--- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java
+++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/ShareClient.java
@@ -17,11 +17,10 @@
import com.azure.storage.file.models.ShareStatistics;
import com.azure.storage.file.models.SignedIdentifier;
import com.azure.storage.file.models.StorageException;
-import reactor.core.publisher.Mono;
-
import java.time.Duration;
import java.util.List;
import java.util.Map;
+import reactor.core.publisher.Mono;
/**
* This class provides a client that contains all the operations for interacting with a share in Azure Storage Share.
diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryAsyncJavaDocCodeSamples.java
index 3e9469de9f2c..094c4ba61a2c 100644
--- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryAsyncJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryAsyncJavaDocCodeSamples.java
@@ -5,7 +5,6 @@
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.models.FileHTTPHeaders;
import com.azure.storage.file.models.NtfsFileAttributes;
-
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java
index caf32d80748a..1923c2416b73 100644
--- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileAsyncJavaDocCodeSamples.java
@@ -7,8 +7,6 @@
import com.azure.storage.file.models.FileProperties;
import com.azure.storage.file.models.FileRange;
import com.azure.storage.file.models.NtfsFileAttributes;
-import reactor.core.publisher.Flux;
-
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.ByteBuffer;
@@ -21,6 +19,7 @@
import java.util.Collections;
import java.util.EnumSet;
import java.util.Map;
+import reactor.core.publisher.Flux;
/**
* Contains code snippets when generating javadocs through doclets for {@link FileClient} and {@link FileAsyncClient}.
diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java
index 767c6836d4cd..d4ed5f6b1ef2 100644
--- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java
@@ -15,7 +15,6 @@
import com.azure.storage.file.models.FileUploadInfo;
import com.azure.storage.file.models.FileUploadRangeFromUrlInfo;
import com.azure.storage.file.models.NtfsFileAttributes;
-
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.ByteBuffer;
diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java
index d6f511c97ace..3ccfb020b787 100644
--- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceAsyncJavaDocCodeSamples.java
@@ -5,7 +5,6 @@
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.models.FileServiceProperties;
import com.azure.storage.file.models.ListSharesOptions;
-
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java
index 77f5aa0dbd59..00f5a9418c42 100644
--- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java
@@ -7,7 +7,6 @@
import com.azure.storage.common.credentials.SharedKeyCredential;
import com.azure.storage.file.models.FileServiceProperties;
import com.azure.storage.file.models.ListSharesOptions;
-
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java
index d74a8b5bd6c4..a86f801c76fb 100644
--- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareAsyncJavaDocCodeSamples.java
@@ -7,7 +7,6 @@
import com.azure.storage.file.models.FileHTTPHeaders;
import com.azure.storage.file.models.NtfsFileAttributes;
import com.azure.storage.file.models.SignedIdentifier;
-
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java
index 813b5591e541..9c970872c47e 100644
--- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java
@@ -13,7 +13,6 @@
import com.azure.storage.file.models.ShareSnapshotInfo;
import com.azure.storage.file.models.ShareStatistics;
import com.azure.storage.file.models.SignedIdentifier;
-
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileSASTests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileSASTests.groovy
index 131c41664c06..ecc68d8a30db 100644
--- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileSASTests.groovy
+++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/FileSASTests.groovy
@@ -1,12 +1,13 @@
package com.azure.storage.file
-import com.azure.storage.common.AccountSASPermission
-import com.azure.storage.common.AccountSASResourceType
-import com.azure.storage.common.AccountSASService
-import com.azure.storage.common.AccountSASSignatureValues
+
+import com.azure.storage.common.AccountSasResourceType
+import com.azure.storage.common.AccountSasService
+import com.azure.storage.common.AccountSasPermission
+import com.azure.storage.common.AccountSasSignatureValues
+import com.azure.storage.common.SasProtocol
import com.azure.storage.common.Constants
import com.azure.storage.common.IpRange
-import com.azure.storage.common.SASProtocol
import com.azure.storage.common.credentials.SharedKeyCredential
import com.azure.storage.file.models.AccessPolicy
import com.azure.storage.file.models.SignedIdentifier
@@ -166,7 +167,7 @@ class FileSASTests extends APISpec {
def ipRange = new IpRange()
.setIpMin("0.0.0.0")
.setIpMax("255.255.255.255")
- def sasProtocol = SASProtocol.HTTPS_HTTP
+ def sasProtocol = SasProtocol.HTTPS_HTTP
def cacheControl = "cache"
def contentDisposition = "disposition"
def contentEncoding = "encoding"
@@ -228,7 +229,7 @@ class FileSASTests extends APISpec {
def ipRange = new IpRange()
.setIpMin("0.0.0.0")
.setIpMax("255.255.255.255")
- def sasProtocol = SASProtocol.HTTPS_HTTP
+ def sasProtocol = SasProtocol.HTTPS_HTTP
def cacheControl = "cache"
def contentDisposition = "disposition"
def contentEncoding = "encoding"
@@ -328,13 +329,13 @@ class FileSASTests extends APISpec {
def "AccountSAS FileService network test create delete share succeeds"() {
setup:
- def service = new AccountSASService()
+ def service = new AccountSasService()
.setFile(true)
- def resourceType = new AccountSASResourceType()
+ def resourceType = new AccountSasResourceType()
.setContainer(true)
.setService(true)
.setObject(true)
- def permissions = new AccountSASPermission()
+ def permissions = new AccountSasPermission()
.setReadPermission(true)
.setCreatePermission(true)
.setDeletePermission(true)
@@ -342,7 +343,7 @@ class FileSASTests extends APISpec {
when:
def credential = SharedKeyCredential.fromConnectionString(connectionString)
- def sas = AccountSASSignatureValues.generateAccountSAS(credential, service, resourceType, permissions, expiryTime, null, null, null, null)
+ def sas = AccountSasSignatureValues.generateAccountSas(credential, service, resourceType, permissions, expiryTime, null, null, null, null)
then:
sas != null
diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java
index 2dddbacc2b52..c0f62f4b30e4 100644
--- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java
+++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java
@@ -2,6 +2,9 @@
// Licensed under the MIT License.
package com.azure.storage.queue;
+import static com.azure.core.implementation.util.FluxUtil.withContext;
+import static com.azure.storage.queue.PostProcessor.postProcessResponse;
+
import com.azure.core.annotation.ServiceClient;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.rest.PagedFlux;
@@ -26,17 +29,13 @@
import com.azure.storage.queue.models.SignedIdentifier;
import com.azure.storage.queue.models.StorageException;
import com.azure.storage.queue.models.UpdatedMessage;
-import reactor.core.publisher.Mono;
-
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
-
-import static com.azure.core.implementation.util.FluxUtil.withContext;
-import static com.azure.storage.queue.PostProcessor.postProcessResponse;
+import reactor.core.publisher.Mono;
/**
* This class provides a client that contains all the operations for interacting with a queue in Azure Storage Queue.
diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java
index 445ac4e52cc0..b782aaa7c35e 100644
--- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java
+++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java
@@ -15,11 +15,10 @@
import com.azure.storage.queue.models.SignedIdentifier;
import com.azure.storage.queue.models.StorageException;
import com.azure.storage.queue.models.UpdatedMessage;
-import reactor.core.publisher.Mono;
-
import java.time.Duration;
import java.util.List;
import java.util.Map;
+import reactor.core.publisher.Mono;
/**
* This class provides a client that contains all the operations for interacting with a queue in Azure Storage Queue.
diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java
index 055ef8b15f6f..945d96ecb4db 100644
--- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java
+++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java
@@ -2,6 +2,9 @@
// Licensed under the MIT License.
package com.azure.storage.queue;
+import static com.azure.core.implementation.util.FluxUtil.withContext;
+import static com.azure.storage.queue.PostProcessor.postProcessResponse;
+
import com.azure.core.annotation.ServiceClient;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedResponse;
@@ -21,17 +24,13 @@
import com.azure.storage.queue.models.StorageException;
import com.azure.storage.queue.models.StorageServiceProperties;
import com.azure.storage.queue.models.StorageServiceStats;
-import reactor.core.publisher.Mono;
-
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
-
-import static com.azure.core.implementation.util.FluxUtil.withContext;
-import static com.azure.storage.queue.PostProcessor.postProcessResponse;
+import reactor.core.publisher.Mono;
/**
* This class provides a client that contains all the operations for interacting with a queue account in Azure Storage.
diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java
index fb18329856e1..605c814e9a4c 100644
--- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java
+++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java
@@ -15,10 +15,9 @@
import com.azure.storage.queue.models.StorageException;
import com.azure.storage.queue.models.StorageServiceProperties;
import com.azure.storage.queue.models.StorageServiceStats;
-import reactor.core.publisher.Mono;
-
import java.time.Duration;
import java.util.Map;
+import reactor.core.publisher.Mono;
/**
* This class provides a client that contains all the operations for interacting with a queue account in Azure Storage.
diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSasQueryParameters.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSasQueryParameters.java
index ce3d5de71237..b283f47a3829 100644
--- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSasQueryParameters.java
+++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSasQueryParameters.java
@@ -6,7 +6,7 @@
import com.azure.storage.common.BaseSasQueryParameters;
import com.azure.storage.common.Constants;
import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
+import com.azure.storage.common.SasProtocol;
import java.time.OffsetDateTime;
import java.util.Map;
@@ -52,7 +52,7 @@ public QueueServiceSasQueryParameters(Map queryParamsMap, bool
* @param permissions A {@code String} representing the storage permissions or {@code null}.
* @param signature A {@code String} representing the signature for the SAS token.
*/
- QueueServiceSasQueryParameters(String version, SASProtocol protocol, OffsetDateTime startTime,
+ QueueServiceSasQueryParameters(String version, SasProtocol protocol, OffsetDateTime startTime,
OffsetDateTime expiryTime, IpRange ipRange, String identifier, String permissions, String signature) {
super(version, protocol, startTime, expiryTime, ipRange, permissions, signature);
diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSasSignatureValues.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSasSignatureValues.java
index 9d6d16a4a3c8..6ef1b2aec995 100644
--- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSasSignatureValues.java
+++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSasSignatureValues.java
@@ -5,7 +5,7 @@
import com.azure.storage.common.Constants;
import com.azure.storage.common.IpRange;
-import com.azure.storage.common.SASProtocol;
+import com.azure.storage.common.SasProtocol;
import com.azure.storage.common.Utility;
import com.azure.storage.common.credentials.SharedKeyCredential;
@@ -32,7 +32,7 @@ public final class QueueServiceSasSignatureValues {
private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION;
- private SASProtocol protocol;
+ private SasProtocol protocol;
private OffsetDateTime startTime;
@@ -72,7 +72,7 @@ public final class QueueServiceSasSignatureValues {
this.identifier = identifier;
}
- QueueServiceSasSignatureValues(String version, SASProtocol sasProtocol, OffsetDateTime startTime,
+ QueueServiceSasSignatureValues(String version, SasProtocol sasProtocol, OffsetDateTime startTime,
OffsetDateTime expiryTime, String permission, IpRange ipRange, String identifier) {
if (version != null) {
this.version = version;
@@ -106,19 +106,19 @@ public QueueServiceSasSignatureValues setVersion(String version) {
}
/**
- * @return the {@link SASProtocol} which determines the protocols allowed by the SAS.
+ * @return the {@link SasProtocol} which determines the protocols allowed by the SAS.
*/
- public SASProtocol getProtocol() {
+ public SasProtocol getProtocol() {
return protocol;
}
/**
- * Sets the {@link SASProtocol} which determines the protocols allowed by the SAS.
+ * Sets the {@link SasProtocol} which determines the protocols allowed by the SAS.
*
* @param protocol Protocol for the SAS
* @return the updated QueueServiceSasSignatureValues object
*/
- public QueueServiceSasSignatureValues setProtocol(SASProtocol protocol) {
+ public QueueServiceSasSignatureValues setProtocol(SasProtocol protocol) {
this.protocol = protocol;
return this;
}
diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueAsyncJavaDocCodeSamples.java
index cf6b3e4479e0..b8aac7689a64 100644
--- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueAsyncJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueAsyncJavaDocCodeSamples.java
@@ -6,7 +6,6 @@
import com.azure.storage.queue.models.AccessPolicy;
import com.azure.storage.queue.models.QueueProperties;
import com.azure.storage.queue.models.SignedIdentifier;
-
import java.time.Duration;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueJavaDocCodeSamples.java
index f69c08be8d64..a60c840ee412 100644
--- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueJavaDocCodeSamples.java
@@ -11,7 +11,6 @@
import com.azure.storage.queue.models.QueueProperties;
import com.azure.storage.queue.models.SignedIdentifier;
import com.azure.storage.queue.models.UpdatedMessage;
-
import java.time.Duration;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceAsyncJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceAsyncJavaDocCodeSamples.java
index 36998f48e588..2db6612086c2 100644
--- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceAsyncJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceAsyncJavaDocCodeSamples.java
@@ -6,7 +6,6 @@
import com.azure.storage.queue.models.QueuesSegmentOptions;
import com.azure.storage.queue.models.StorageServiceProperties;
import com.azure.storage.queue.models.StorageServiceStats;
-
import java.util.Collections;
import java.util.Map;
diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceJavaDocCodeSamples.java
index 2a91874c6bd9..74543642f120 100644
--- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceJavaDocCodeSamples.java
+++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceJavaDocCodeSamples.java
@@ -8,7 +8,6 @@
import com.azure.storage.queue.models.QueuesSegmentOptions;
import com.azure.storage.queue.models.StorageServiceProperties;
import com.azure.storage.queue.models.StorageServiceStats;
-
import java.time.Duration;
import java.util.Collections;
import java.util.Map;
diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueSASTests.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueSASTests.groovy
index 3a63224a208a..17df71e3267b 100644
--- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueSASTests.groovy
+++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueSASTests.groovy
@@ -1,11 +1,13 @@
package com.azure.storage.queue
-import com.azure.storage.common.AccountSASPermission
-import com.azure.storage.common.AccountSASResourceType
-import com.azure.storage.common.AccountSASService
-import com.azure.storage.common.AccountSASSignatureValues
+
+import com.azure.storage.common.AccountSasPermission
+import com.azure.storage.common.AccountSasResourceType
+import com.azure.storage.common.AccountSasService
+import com.azure.storage.common.AccountSasSignatureValues
+import com.azure.storage.common.SasProtocol
+
import com.azure.storage.common.IpRange
-import com.azure.storage.common.SASProtocol
import com.azure.storage.common.credentials.SharedKeyCredential
import com.azure.storage.queue.models.AccessPolicy
import com.azure.storage.queue.models.EnqueuedMessage
@@ -106,7 +108,7 @@ class QueueSASTests extends APISpec {
def ipRange = new IpRange()
.setIpMin("0.0.0.0")
.setIpMax("255.255.255.255")
- def sasProtocol = SASProtocol.HTTPS_HTTP
+ def sasProtocol = SasProtocol.HTTPS_HTTP
when:
def credential = SharedKeyCredential.fromConnectionString(connectionString)
@@ -156,7 +158,7 @@ class QueueSASTests extends APISpec {
def ipRange = new IpRange()
.setIpMin("0.0.0.0")
.setIpMax("255.255.255.255")
- def sasProtocol = SASProtocol.HTTPS_HTTP
+ def sasProtocol = SasProtocol.HTTPS_HTTP
when:
def credential = SharedKeyCredential.fromConnectionString(connectionString)
@@ -235,13 +237,13 @@ class QueueSASTests extends APISpec {
@Test
def "Test Account QueueServiceSAS create queue delete queue"() {
- def service = new AccountSASService()
+ def service = new AccountSasService()
.setQueue(true)
- def resourceType = new AccountSASResourceType()
+ def resourceType = new AccountSasResourceType()
.setContainer(true)
.setService(true)
.setObject(true)
- def permissions = new AccountSASPermission()
+ def permissions = new AccountSasPermission()
.setReadPermission(true)
.setCreatePermission(true)
.setDeletePermission(true)
@@ -249,7 +251,7 @@ class QueueSASTests extends APISpec {
when:
def credential = SharedKeyCredential.fromConnectionString(connectionString)
- def sas = AccountSASSignatureValues.generateAccountSAS(credential, service, resourceType, permissions, expiryTime, null, null, null, null)
+ def sas = AccountSasSignatureValues.generateAccountSas(credential, service, resourceType, permissions, expiryTime, null, null, null, null)
def scBuilder = queueServiceBuilderHelper(interceptorManager)
scBuilder.endpoint(primaryQueueServiceClient.getQueueServiceUrl())
@@ -269,19 +271,19 @@ class QueueSASTests extends APISpec {
@Test
def "Test Account QueueServiceSAS list queues"() {
- def service = new AccountSASService()
+ def service = new AccountSasService()
.setQueue(true)
- def resourceType = new AccountSASResourceType()
+ def resourceType = new AccountSasResourceType()
.setContainer(true)
.setService(true)
.setObject(true)
- def permissions = new AccountSASPermission()
+ def permissions = new AccountSasPermission()
.setListPermission(true)
def expiryTime = getUTCNow().plusDays(1)
when:
def credential = SharedKeyCredential.fromConnectionString(connectionString)
- def sas = AccountSASSignatureValues.generateAccountSAS(credential, service, resourceType, permissions, expiryTime, null, null, null, null)
+ def sas = AccountSasSignatureValues.generateAccountSas(credential, service, resourceType, permissions, expiryTime, null, null, null, null)
def scBuilder = queueServiceBuilderHelper(interceptorManager)
scBuilder.endpoint(primaryQueueServiceClient.getQueueServiceUrl())
From 950bc61200c186069e6701d5436ca4820d6e6788 Mon Sep 17 00:00:00 2001
From: Srikanta <51379715+srnagar@users.noreply.github.com>
Date: Fri, 4 Oct 2019 15:14:12 -0700
Subject: [PATCH 15/18] Update README and CHANGELOG for Event Hubs (#5700)
* Update README and CHANGELOG for Event Hubs
* Add async clients to changelog
---
.../CHANGELOG.md | 3 ++
.../README.md | 35 ---------------
.../azure-messaging-eventhubs/CHANGELOG.md | 8 ++++
.../azure-messaging-eventhubs/README.md | 44 +++----------------
4 files changed, 16 insertions(+), 74 deletions(-)
diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md
index 79c721eff657..17435186ccbd 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md
+++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md
@@ -1,5 +1,8 @@
# Release History
+## 1.0.0-preview.2 (2019-10-08)
+- Added modules support for JDK 9+.
+
## 1.0.0-preview.1 (2019-09-09)
Version 1.0.0-preview.1 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic
diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md
index 2168532decf8..25aabcd8303d 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md
+++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md
@@ -30,41 +30,6 @@ documentation][event_hubs_product_docs] | [Samples][sample_examples]
```
-### Default HTTP Client
-All client libraries support a pluggable HTTP transport layer. Users can specify an HTTP client specific for their needs by including the following dependency in the Maven pom.xml file:
-
-```xml
-
- com.azure
- azure-core-http-netty
- 1.0.0-preview.4
-
-```
-
-This will automatically configure all client libraries on the same classpath to make use of Netty for the HTTP client. Netty is the recommended HTTP client for most applications. OkHttp is recommended only when the application being built is deployed to Android devices.
-
-If, instead of Netty it is preferable to use OkHTTP, there is a HTTP client available for that too. Simply include the following dependency instead:
-
-```xml
-
- com.azure
- azure-core-http-okhttp
- 1.0.0-preview.4
-
-```
-
-### Configuring HTTP Clients
-When an HTTP client is included on the classpath, as shown above, it is not necessary to specify it in the client library [builders](#create-an-instance-of-storage-container-client), unless you want to customize the HTTP client in some fashion. If this is desired, the `httpClient` builder method is often available to achieve just this, by allowing users to provide a custom (or customized) `com.azure.core.http.HttpClient` instances.
-
-For starters, by having the Netty or OkHTTP dependencies on your classpath, as shown above, you can create new instances of these `HttpClient` types using their builder APIs. For example, here is how you would create a Netty HttpClient instance:
-
-```java
-HttpClient client = new NettyAsyncHttpClientBuilder()
- .port(8080)
- .wiretap(true)
- .build();
-```
-
### Authenticate the storage container client
In order to create an instance of `BlobPartitionManager`, a `ContainerAsyncClient` should first be created with
appropriate SAS token with write access and connection string. To make this possible you'll need the Account SAS
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md
index b3b5fd34a7e8..3e5b6f1327a1 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md
+++ b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md
@@ -1,5 +1,13 @@
# Release History
+## 5.0.0-preview.4 (2019-10-08)
+- Proxy support for Event Hubs sync and async clients.
+- `EventHubConsumer` and `EventHubAsyncConsumer` now provides last enqueued event information.
+- Refactored `azure-messaging-eventhubs` to extract AMQP implementation details to `azure-core-amqp` module.
+- Added modules support for JDK 9+.
+- Renamed model classes to support Java bean naming convention.
+- `EventHubClient` and `EventHubAsyncClient` now provides method to get the name of the Event Hub associated with the client.
+
## 5.0.0-preview.3 (2019-09-09)
- Added synchronous `EventHubConsumer` and `EventHubProducer`.
diff --git a/sdk/eventhubs/azure-messaging-eventhubs/README.md b/sdk/eventhubs/azure-messaging-eventhubs/README.md
index 24eeac44a8ec..45db16c1f164 100644
--- a/sdk/eventhubs/azure-messaging-eventhubs/README.md
+++ b/sdk/eventhubs/azure-messaging-eventhubs/README.md
@@ -25,8 +25,6 @@ documentation][event_hubs_product_docs] | [Samples][sample_examples]
- [Getting started](#getting-started)
- [Prerequisites](#prerequisites)
- [Adding the package to your product](#adding-the-package-to-your-product)
- - [Default Http Client](#default-http-client)
- - [Configuring Http Clients](#configuring-http-clients)
- [Methods to authorize with Event Hubs](#methods-to-authorize-with-event-hubs)
- [Create an Event Hub client using a connection string](#create-an-event-hub-client-using-a-connection-string)
- [Create an Event Hub client using Microsoft identity platform (formerly Azure Active Directory)](#create-an-event-hub-client-using-microsoft-identity-platform-formerly-azure-active-directory)
@@ -64,41 +62,6 @@ documentation][event_hubs_product_docs] | [Samples][sample_examples]
```
-### Default HTTP Client
-All client libraries support a pluggable HTTP transport layer. Users can specify an HTTP client specific for their needs by including the following dependency in the Maven pom.xml file:
-
-```xml
-
- com.azure
- azure-core-http-netty
- 1.0.0-preview.4
-
-```
-
-This will automatically configure all client libraries on the same classpath to make use of Netty for the HTTP client. Netty is the recommended HTTP client for most applications. OkHttp is recommended only when the application being built is deployed to Android devices.
-
-If, instead of Netty it is preferable to use OkHTTP, there is a HTTP client available for that too. Simply include the following dependency instead:
-
-```xml
-
- com.azure
- azure-core-http-okhttp
- 1.0.0-preview.4
-
-```
-
-### Configuring HTTP Clients
-When an HTTP client is included on the classpath, as shown above, it is not necessary to specify it in the client library [builders](#create-an-event-hub-client-using-a-connection-string), unless you want to customize the HTTP client in some fashion. If this is desired, the `httpClient` builder method is often available to achieve just this, by allowing users to provide a custom (or customized) `com.azure.core.http.HttpClient` instances.
-
-For starters, by having the Netty or OkHTTP dependencies on your classpath, as shown above, you can create new instances of these `HttpClient` types using their builder APIs. For example, here is how you would create a Netty HttpClient instance:
-
-```java
-HttpClient client = new NettyAsyncHttpClientBuilder()
- .port(8080)
- .wiretap(true)
- .build();
-```
-
### Methods to authorize with Event Hubs
For the Event Hubs client library to interact with an Event Hub, it will need to understand how to connect and authorize
@@ -132,7 +95,7 @@ platform. First, add the package:
com.azure
azure-identity
- 1.0.0-preview.3
+ 1.0.0-preview.4
```
@@ -272,7 +235,7 @@ EventHubAsyncClient client = new EventHubClientBuilder()
String partitionId = "<< EVENT HUB PARTITION ID >>"
EventHubAsyncConsumer consumer = client.createConsumer(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, partitionId,
- EventPosition.latest());
+ EventPosition.earliest());
consumer.receive().subscribe(event -> {
// Process each event as it arrives.
@@ -333,6 +296,9 @@ class Program {
// This will start the processor. It will start processing events from all partitions.
eventProcessor.start();
+
+ // (for demo purposes only - adding sleep to wait for receiving events)
+ TimeUnit.SECONDS.sleep(2);
// When the user wishes to stop processing events, they can call `stop()`.
eventProcessor.stop();
From baa2dabfef36571a3d41ee2a36ef2b4067107c17 Mon Sep 17 00:00:00 2001
From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com>
Date: Fri, 4 Oct 2019 15:59:46 -0700
Subject: [PATCH 16/18] Add remove to HttpHeaders (#5704)
* Add remove to HttpHeaders
* Use ConcurrentHashMap
---
.../java/com/azure/core/http/HttpHeaders.java | 37 +++++++++++++------
1 file changed, 25 insertions(+), 12 deletions(-)
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java
index bbeb3c13fcd3..429a2a82ac6d 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java
@@ -7,13 +7,14 @@
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Stream;
/**
* A collection of headers on an HTTP request or response.
*/
public class HttpHeaders implements Iterable {
- private final Map headers = new HashMap<>();
+ private final Map headers = new ConcurrentHashMap<>();
/**
* Create an empty HttpHeaders instance.
@@ -55,9 +56,9 @@ public int getSize() {
}
/**
- * Set a header.
+ * Sets a {@link HttpHeader header} with the given name and value.
*
- * If header with same name already exists then the value will be overwritten.
+ * If header with same name already exists then the value will be overwritten.
*
* @param name the name
* @param value the value
@@ -69,7 +70,8 @@ public HttpHeaders put(String name, String value) {
}
/**
- * Get the {@link HttpHeader header} for the provided header name. Null will be returned if the header isn't found.
+ * Gets the {@link HttpHeader header} for the provided header name. {@code Null} is returned if the header isn't
+ * found.
*
* @param name the name of the header to find.
* @return the header if found, null otherwise.
@@ -79,11 +81,21 @@ public HttpHeader get(String name) {
}
/**
- * Get the header value for the provided header name. Null will be returned if the header
- * name isn't found.
+ * Removes the {@link HttpHeader header} with the provided header name. {@code Null} is returned if the header
+ * isn't found.
*
- * @param name the name of the header to look for
- * @return The String value of the header, or null if the header isn't found
+ * @param name the name of the header to remove.
+ * @return the header if removed, null otherwise.
+ */
+ public HttpHeader remove(String name) {
+ return headers.remove(formatKey(name));
+ }
+
+ /**
+ * Get the value for the provided header name. {@code Null} is returned if the header name isn't found.
+ *
+ * @param name the name of the header whose value is being retrieved.
+ * @return the value of the header, or null if the header isn't found
*/
public String getValue(String name) {
final HttpHeader header = get(name);
@@ -91,10 +103,11 @@ public String getValue(String name) {
}
/**
- * Get the header values for the provided header name. Null will be returned if
- * the header name isn't found.
+ * Get the values for the provided header name. {@code Null} is returned if the header name isn't found.
+ *
+ * This returns {@link #getValue(String) getValue} split by {@code comma}.
*
- * @param name the name of the header to look for
+ * @param name the name of the header whose value is being retrieved.
* @return the values of the header, or null if the header isn't found
*/
public String[] getValues(String name) {
@@ -107,7 +120,7 @@ private String formatKey(final String key) {
}
/**
- * Get {@link Map} representation of the HttpHeaders collection.
+ * Gets a {@link Map} representation of the HttpHeaders collection.
*
* @return the headers as map
*/
From 531abcb698b1aa8c2f22b5ff0e02dc6c392e517d Mon Sep 17 00:00:00 2001
From: Chris
Date: Sun, 6 Oct 2019 23:59:02 -0700
Subject: [PATCH 17/18] New Checkstyle for disallowed words. (5530)
---
.../checks/DisallowedWordsCheck.java | 55 ++++++-------------
.../main/resources/checkstyle/checkstyle.xml | 2 +-
.../checks/DisallowedWordsCheckTests.java | 4 +-
.../DisallowedWordsTestData.java | 9 ++-
4 files changed, 26 insertions(+), 44 deletions(-)
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheck.java
index 6f42eb0a66e8..b17cea542f4d 100644
--- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheck.java
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheck.java
@@ -14,18 +14,16 @@
import java.util.stream.Collectors;
public class DisallowedWordsCheck extends AbstractCheck {
- private final String[] DEFAULT_VALUES = new String[] { "URL", "HTTP" };
- private Set disallowedWords = new HashSet<>(Arrays.asList(DEFAULT_VALUES));
+ private Set disallowedWords = new HashSet<>(Arrays.asList());
private String errorMessage = "%s, All Public API Classes, Fields and Methods should follow " +
"Camelcase standards for the following words: %s.";
- private boolean applyToPublic = true;
/**
* Adds words that Classes, Methods and Variables that should follow Camelcasing standards
* @param disallowedWords words that should follow normal Camelcasing standards
*/
public final void setDisallowedWords(String... disallowedWords) {
- if (this.disallowedWords != null) {
+ if (disallowedWords != null) {
Collections.addAll(this.disallowedWords, disallowedWords);
}
}
@@ -52,11 +50,10 @@ public void visitToken(DetailAST token) {
switch (token.getType()) {
case TokenTypes.CLASS_DEF:
case TokenTypes.METHOD_DEF:
- case TokenTypes.VARIABLE_DEF:
- String tokenName = token.findFirstToken(TokenTypes.IDENT).getText();
- if (shouldCheckInScope(token)) {
- String result = getDisallowedWords(tokenName);
- if (result != null) {
+ if (isPublicAPI(token)) {
+ String tokenName = token.findFirstToken(TokenTypes.IDENT).getText();
+ boolean found = getDisallowedWords(tokenName);
+ if (found) {
log(token, String.format(errorMessage, tokenName, this.disallowedWords.stream().collect(Collectors.joining(", ", "", ""))));
}
}
@@ -74,12 +71,14 @@ public void visitToken(DetailAST token) {
* modifiers of member to check.
* @return true if we should check such member.
*/
- private boolean shouldCheckInScope(DetailAST token) {
+ private boolean isPublicAPI(DetailAST token) {
final DetailAST modifiersAST =
token.findFirstToken(TokenTypes.MODIFIERS);
+ final boolean isStatic = modifiersAST.findFirstToken(TokenTypes.LITERAL_STATIC) != null;
final boolean isPublic = modifiersAST
.findFirstToken(TokenTypes.LITERAL_PUBLIC) != null;
- return applyToPublic && isPublic;
+ final boolean isProtected = modifiersAST.findFirstToken(TokenTypes.LITERAL_PROTECTED) != null;
+ return (isPublic || isProtected) && !isStatic;
}
/**
@@ -89,36 +88,14 @@ private boolean shouldCheckInScope(DetailAST token) {
* @return the disallowed abbreviation contained in given String as a
* separate String.
*/
- private String getDisallowedWords(String tokenName) {
- int beginIndex = 0;
- boolean abbrStarted = false;
- String result = null;
-
- for (int index = 0; index < tokenName.length(); index++) {
- final char symbol = tokenName.charAt(index);
-
- if (Character.isUpperCase(symbol)) {
- if (!abbrStarted) {
- abbrStarted = true;
- beginIndex = index;
- }
- }
- else if (abbrStarted) {
- abbrStarted = false;
-
- final int endIndex = index - 1;
- result = getAbbreviationIfIllegal(tokenName, beginIndex, endIndex);
- if (result != null) {
- break;
- }
- beginIndex = -1;
+ private boolean getDisallowedWords(String tokenName) {
+ boolean result = false;
+ for (String disallowedWord : disallowedWords) {
+ if (tokenName.contains(disallowedWord)) {
+ result = true;
+ break;
}
}
- // if abbreviation at the end of name (example: scaleX)
- if (abbrStarted) {
- final int endIndex = tokenName.length() - 1;
- result = getAbbreviationIfIllegal(tokenName, beginIndex, endIndex);
- }
return result;
}
diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml
index f1f600738750..d4ceb5d11f86 100755
--- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml
+++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml
@@ -385,7 +385,7 @@ page at http://checkstyle.sourceforge.net/config.html -->
-
+
diff --git a/eng/code-quality-reports/src/test/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheckTests.java b/eng/code-quality-reports/src/test/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheckTests.java
index 97a7e4206c87..7d87d1d28fb5 100644
--- a/eng/code-quality-reports/src/test/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheckTests.java
+++ b/eng/code-quality-reports/src/test/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheckTests.java
@@ -33,8 +33,8 @@ protected String getPackageLocation() {
@Test
public void disallowedWordsTestData() throws Exception {
String[] expected = {
- expectedErrorMessage(2, 5, String.format(DISALLOWED_WORD_ERROR_MESSAGE, "errorURLCase")),
- expectedErrorMessage(4, 5, String.format(DISALLOWED_WORD_ERROR_MESSAGE, "errorHTTPMethod"))
+ expectedErrorMessage(3, 5, String.format(DISALLOWED_WORD_ERROR_MESSAGE, "errorHTTPMethod")),
+ expectedErrorMessage(9, 5, String.format(DISALLOWED_WORD_ERROR_MESSAGE, "invalidXMLMethod"))
};
verify(checker, getPath("DisallowedWordsTestData.java"), expected);
}
diff --git a/eng/code-quality-reports/src/test/resources/com/azure/tools/checkstyle/checks/DisallowedWordsChecks/DisallowedWordsTestData.java b/eng/code-quality-reports/src/test/resources/com/azure/tools/checkstyle/checks/DisallowedWordsChecks/DisallowedWordsTestData.java
index 9c65f0bf6ad7..136039315a06 100644
--- a/eng/code-quality-reports/src/test/resources/com/azure/tools/checkstyle/checks/DisallowedWordsChecks/DisallowedWordsTestData.java
+++ b/eng/code-quality-reports/src/test/resources/com/azure/tools/checkstyle/checks/DisallowedWordsChecks/DisallowedWordsTestData.java
@@ -1,7 +1,12 @@
+@JacksonXmlRootElement(localName = "File-SetHTTPHeaders-Headers")
public class CamelCaseTestData {
- public boolean errorURLCase;
-
public void errorHTTPMethod() { throw new RuntimeException("Error Messages."); }
public void validHttpMethod() { throw new RuntimeException("Error Messages."); }
+
+ public static void itIsAURLError() { throw new RuntimeException("Error Messages."); }
+
+ protected void invalidXMLMethod() { throw new RuntimeException("Error Messages."); }
+
+ private void shouldNotSearch() { throw new RuntimeException("Error Messages."); }
}
From 1b49e6608a48dd067ab89ef8c15ee4a373dae87f Mon Sep 17 00:00:00 2001
From: chrischild
Date: Fri, 25 Oct 2019 14:34:58 -0700
Subject: [PATCH 18/18] Refactored New Checkstyle
---
...sCheck.java => BlacklistedWordsCheck.java} | 69 +++++++------------
.../checkstyle/checkstyle-suppressions.xml | 3 +
.../main/resources/checkstyle/checkstyle.xml | 6 +-
...s.java => BlacklistedWordsCheckTests.java} | 23 ++++---
.../BlacklistedWordsTestData.java} | 0
5 files changed, 43 insertions(+), 58 deletions(-)
rename eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/{DisallowedWordsCheck.java => BlacklistedWordsCheck.java} (53%)
rename eng/code-quality-reports/src/test/java/com/azure/tools/checkstyle/checks/{DisallowedWordsCheckTests.java => BlacklistedWordsCheckTests.java} (61%)
rename eng/code-quality-reports/src/test/resources/com/azure/tools/checkstyle/checks/{DisallowedWordsChecks/DisallowedWordsTestData.java => BlacklistedWordsChecks/BlacklistedWordsTestData.java} (100%)
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/BlacklistedWordsCheck.java
similarity index 53%
rename from eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheck.java
rename to eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/BlacklistedWordsCheck.java
index b17cea542f4d..77ea661f397a 100644
--- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/DisallowedWordsCheck.java
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/BlacklistedWordsCheck.java
@@ -13,18 +13,25 @@
import java.util.Set;
import java.util.stream.Collectors;
-public class DisallowedWordsCheck extends AbstractCheck {
- private Set disallowedWords = new HashSet<>(Arrays.asList());
- private String errorMessage = "%s, All Public API Classes, Fields and Methods should follow " +
+/**
+ * Ensure that code is not using words or abbreviations that are blacklisted by this Checkstyle.
+ * blacklistedWords: the words that have been blacklisted in the checkstyle.xml config file
+ *
+ * Prints out a message stating the location and the class, method or variable as well as the list
+ * blacklisted words.
+ */
+public class BlacklistedWordsCheck extends AbstractCheck {
+ private final Set blacklistedWords = new HashSet<>(Arrays.asList());
+ private final String ERROR_MESSAGE = "%s, All Public API Classes, Fields and Methods should follow " +
"Camelcase standards for the following words: %s.";
/**
* Adds words that Classes, Methods and Variables that should follow Camelcasing standards
- * @param disallowedWords words that should follow normal Camelcasing standards
+ * @param blacklistedWords words that should follow normal Camelcasing standards
*/
- public final void setDisallowedWords(String... disallowedWords) {
- if (disallowedWords != null) {
- Collections.addAll(this.disallowedWords, disallowedWords);
+ public final void setBlacklistedWords(String... blacklistedWords) {
+ if (blacklistedWords != null) {
+ Collections.addAll(this.blacklistedWords, blacklistedWords);
}
}
@@ -41,8 +48,8 @@ public int[] getAcceptableTokens() {
@Override
public int[] getRequiredTokens() {
return new int[] {TokenTypes.CLASS_DEF,
- TokenTypes.VARIABLE_DEF,
- TokenTypes.METHOD_DEF};
+ TokenTypes.METHOD_DEF,
+ TokenTypes.VARIABLE_DEF};
}
@Override
@@ -50,11 +57,11 @@ public void visitToken(DetailAST token) {
switch (token.getType()) {
case TokenTypes.CLASS_DEF:
case TokenTypes.METHOD_DEF:
- if (isPublicAPI(token)) {
+ case TokenTypes.VARIABLE_DEF:
+ if (isPublicApi(token)) {
String tokenName = token.findFirstToken(TokenTypes.IDENT).getText();
- boolean found = getDisallowedWords(tokenName);
- if (found) {
- log(token, String.format(errorMessage, tokenName, this.disallowedWords.stream().collect(Collectors.joining(", ", "", ""))));
+ if (hasBlacklistedWords(tokenName)) {
+ log(token, String.format(ERROR_MESSAGE, tokenName, this.blacklistedWords.stream().collect(Collectors.joining(", ", "", ""))));
}
}
break;
@@ -71,7 +78,7 @@ public void visitToken(DetailAST token) {
* modifiers of member to check.
* @return true if we should check such member.
*/
- private boolean isPublicAPI(DetailAST token) {
+ private boolean isPublicApi(DetailAST token) {
final DetailAST modifiersAST =
token.findFirstToken(TokenTypes.MODIFIERS);
final boolean isStatic = modifiersAST.findFirstToken(TokenTypes.LITERAL_STATIC) != null;
@@ -88,42 +95,14 @@ private boolean isPublicAPI(DetailAST token) {
* @return the disallowed abbreviation contained in given String as a
* separate String.
*/
- private boolean getDisallowedWords(String tokenName) {
+ private boolean hasBlacklistedWords(String tokenName) {
boolean result = false;
- for (String disallowedWord : disallowedWords) {
- if (tokenName.contains(disallowedWord)) {
+ for (String blacklistedWord : blacklistedWords) {
+ if (tokenName.contains(blacklistedWord)) {
result = true;
break;
}
}
return result;
}
-
- /**
- * Get Abbreviation if it is illegal, where {@code beginIndex} and {@code endIndex} are
- * inclusive indexes of a sequence of consecutive upper-case characters.
- * @param tokenName name
- * @param beginIndex begin index
- * @param endIndex end index
- * @return the abbreviation if it is bigger than required and not in the
- * ignore list, otherwise {@code null}
- */
- private String getAbbreviationIfIllegal(String tokenName, int beginIndex, int endIndex) {
- String result = null;
- final String abbr = getAbbreviation(tokenName, beginIndex, endIndex);
- if (disallowedWords.contains(abbr)) {
- result = abbr;
- }
- return result;
- }
-
- private static String getAbbreviation(String tokenName, int beginIndex, int endIndex) {
- String result;
- if (endIndex == tokenName.length() - 1) {
- result = tokenName.substring(beginIndex);
- } else {
- result = tokenName.substring(beginIndex, endIndex);
- }
- return result;
- }
}
diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml
index 51c9f08a2db4..7b2a3df95190 100755
--- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml
+++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml
@@ -206,4 +206,7 @@
+
+
+
diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml
index d4ceb5d11f86..7fcd3ce40c5b 100755
--- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml
+++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml
@@ -384,9 +384,9 @@ page at http://checkstyle.sourceforge.net/config.html -->
-
-
-
+
+
+