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 { *

  1. Playback: (default if no test mode setup)
  2. * */ - 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 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 7f9fec33109e745c8d2f985a337847bd52ab911c Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 22 Oct 2019 11:51:47 -0700 Subject: [PATCH 18/18] Changes from new checkstyle --- sdk/core/azure-core-management/pom.xml | 6 + .../AzureProxyToRestProxyTests.java | 122 ++++---- .../management/http/MockAzureHttpClient.java | 14 +- .../java/com/azure/core/test/HttpBinJSON.java | 2 +- .../com/azure/core/test/MyAzureException.java | 8 +- .../com/azure/core/test/MyRestException.java | 6 +- .../azure/core/test/http/MockHttpClient.java | 22 +- .../test/implementation/RestProxyTests.java | 286 +++++++++--------- .../RestProxyWithMockTests.java | 8 +- .../azure/core/http/policy/HostPolicy.java | 2 +- .../azure/core/http/policy/PortPolicy.java | 2 +- .../core/http/policy/ProtocolPolicy.java | 2 +- .../azure/core/implementation/RestProxy.java | 2 +- .../entities/HttpBinFormDataJSON.java | 2 +- .../implementation/entities/HttpBinJSON.java | 2 +- .../core/implementation/http/UrlBuilder.java | 2 +- .../com/azure/core/MyOtherRestException.java | 8 +- .../java/com/azure/core/MyRestException.java | 8 +- .../core/http/clients/MockHttpClient.java | 22 +- .../implementation/RestProxyXMLTests.java | 8 +- .../SwaggerMethodParserTests.java | 14 +- .../implementation/http/UrlBuilderTests.java | 4 +- .../azure/storage/blob/BlobAsyncClient.java | 14 +- .../com/azure/storage/blob/BlobClient.java | 8 +- .../com/azure/storage/blob/BlobUrlParts.java | 6 +- .../blob/implementation/AppendBlobsImpl.java | 4 +- .../blob/implementation/BlobsImpl.java | 34 +-- .../blob/implementation/BlockBlobsImpl.java | 14 +- .../blob/implementation/PageBlobsImpl.java | 12 +- .../models/BlobAbortCopyFromURLHeaders.java | 12 +- .../models/BlobCopyFromURLHeaders.java | 22 +- .../models/BlobSetHTTPHeadersHeaders.java | 18 +- .../models/BlobStartCopyFromURLHeaders.java | 22 +- .../models/BlobsAbortCopyFromURLResponse.java | 4 +- .../models/BlobsCopyFromURLResponse.java | 4 +- .../models/BlobsSetHTTPHeadersResponse.java | 4 +- .../models/BlobsStartCopyFromURLResponse.java | 4 +- .../BlockBlobStageBlockFromURLHeaders.java | 20 +- .../BlockBlobsStageBlockFromURLResponse.java | 4 +- .../PageBlobUploadPagesFromURLHeaders.java | 24 +- .../PageBlobsUploadPagesFromURLResponse.java | 4 +- .../storage/blob/models/BlobHTTPHeaders.java | 14 +- .../storage/blob/models/PageBlobItem.java | 4 +- .../specialized/AppendBlobAsyncClient.java | 12 +- .../blob/specialized/AppendBlobClient.java | 8 +- .../blob/specialized/BlobAsyncClientBase.java | 80 ++--- .../blob/specialized/BlobClientBase.java | 60 ++-- .../specialized/BlockBlobAsyncClient.java | 32 +- .../blob/specialized/BlockBlobClient.java | 24 +- .../blob/specialized/PageBlobAsyncClient.java | 26 +- .../blob/specialized/PageBlobClient.java | 18 +- .../BlobAsyncClientJavaDocCodeSnippets.java | 98 +++--- .../blob/BlobClientJavaDocCodeSnippets.java | 90 +++--- .../SetMetadataAndHTTPHeadersExample.java | 6 +- ...endBlobAsyncClientJavaDocCodeSnippets.java | 6 +- .../AppendBlobClientJavaDocCodeSnippets.java | 10 +- ...lobAsyncClientBaseJavaDocCodeSnippets.java | 82 ++--- .../BlobClientBaseJavaDocCodeSnippets.java | 82 ++--- ...ockBlobAsyncClientJavaDocCodeSnippets.java | 34 +-- .../BlockBlobClientJavaDocCodeSnippets.java | 34 +-- ...ageBlobAsyncClientJavaDocCodeSnippets.java | 26 +- .../PageBlobClientJavaDocCodeSnippets.java | 26 +- .../com/azure/storage/blob/BlobAPITest.groovy | 70 ++--- .../com/azure/storage/blob/CPKTest.groovy | 4 +- .../storage/blob/ContainerAPITest.groovy | 2 +- .../storage/blob/RequestRetryTestFactory.java | 2 +- .../com/azure/storage/blob/SASTest.groovy | 2 +- .../blob/specialized/AppendBlobAPITest.groovy | 4 +- .../blob/specialized/BlockBlobAPITest.groovy | 30 +- .../blob/specialized/HelperTest.groovy | 2 +- .../blob/specialized/PageBlobAPITest.groovy | 22 +- .../com/azure/storage/common/Utility.java | 4 +- .../common/policy/RequestRetryPolicy.java | 2 +- ...SASTokenCredentialJavaDocCodeSnippets.java | 6 +- .../storage/file/DirectoryAsyncClient.java | 6 +- .../azure/storage/file/DirectoryClient.java | 4 +- .../azure/storage/file/FileAsyncClient.java | 30 +- .../com/azure/storage/file/FileClient.java | 10 +- .../file/FileServiceSasSignatureValues.java | 2 +- .../azure/storage/file/ShareAsyncClient.java | 6 +- .../com/azure/storage/file/ShareClient.java | 4 +- .../file/implementation/FilesImpl.java | 20 +- .../models/FileSetHTTPHeadersHeaders.java | 30 +- .../models/FileUploadRangeFromURLHeaders.java | 18 +- .../models/FilesSetHTTPHeadersResponse.java | 4 +- .../FilesUploadRangeFromURLResponse.java | 4 +- .../storage/file/models/FileHTTPHeaders.java | 14 +- .../DirectoryAsyncJavaDocCodeSamples.java | 60 ++-- .../file/DirectoryJavaDocCodeSamples.java | 60 ++-- .../file/FileAsyncJavaDocCodeSamples.java | 110 +++---- .../storage/file/FileJavaDocCodeSamples.java | 106 +++---- .../FileServiceAsyncJavaDocCodeSamples.java | 28 +- .../file/FileServiceJavaDocCodeSamples.java | 26 +- .../file/ShareAsyncJavaDocCodeSamples.java | 70 ++--- .../storage/file/ShareJavaDocCodeSamples.java | 74 ++--- .../storage/file/DirectoryAPITests.groovy | 14 +- .../file/DirectoryAsyncAPITests.groovy | 14 +- .../azure/storage/file/FileAPITests.groovy | 6 +- .../storage/file/FileAsyncAPITests.groovy | 6 +- .../azure/storage/file/FileSASTests.groovy | 8 +- .../azure/storage/file/ShareAPITests.groovy | 4 +- .../storage/file/ShareAsyncAPITests.groovy | 14 +- .../queue/QueueServiceSasSignatureValues.java | 6 +- .../queue/QueueAsyncJavaDocCodeSamples.java | 8 +- .../queue/QueueJavaDocCodeSamples.java | 4 +- .../QueueServiceAsyncJavaDocCodeSamples.java | 4 +- .../queue/QueueServiceJavaDocCodeSamples.java | 4 +- .../azure/storage/queue/QueueSASTests.groovy | 6 +- 108 files changed, 1249 insertions(+), 1243 deletions(-) diff --git a/sdk/core/azure-core-management/pom.xml b/sdk/core/azure-core-management/pom.xml index 8fb8f5c6b492..894f34928ba1 100644 --- a/sdk/core/azure-core-management/pom.xml +++ b/sdk/core/azure-core-management/pom.xml @@ -85,6 +85,12 @@ slf4j-simple test + + com.azure + azure-core-test + 1.0.0-preview.5 + test + diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyTests.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyTests.java index e990d08bb36b..75babc74ed9b 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyTests.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyTests.java @@ -29,7 +29,7 @@ import com.azure.core.implementation.http.ContentType; import com.azure.core.management.implementation.AzureProxy; -import com.azure.core.test.HttpBinJSON; +import com.azure.core.test.HttpBinJson; import com.azure.core.test.MyAzureException; import org.junit.Assert; import org.junit.Test; @@ -151,28 +151,28 @@ public void asyncGetRequestWithNoReturn() { private interface Service5 { @Get("anything") @ExpectedResponses({200}) - HttpBinJSON getAnything(); + HttpBinJson getAnything(); @Get("anything/with+plus") @ExpectedResponses({200}) - HttpBinJSON getAnythingWithPlus(); + HttpBinJson getAnythingWithPlus(); @Get("anything/{path}") @ExpectedResponses({200}) - HttpBinJSON getAnythingWithPathParam(@PathParam("path") String pathParam); + HttpBinJson getAnythingWithPathParam(@PathParam("path") String pathParam); @Get("anything/{path}") @ExpectedResponses({200}) - HttpBinJSON getAnythingWithEncodedPathParam(@PathParam(value = "path", encoded = true) String pathParam); + HttpBinJson getAnythingWithEncodedPathParam(@PathParam(value = "path", encoded = true) String pathParam); @Get("anything") @ExpectedResponses({200}) - Mono getAnythingAsync(); + Mono getAnythingAsync(); } @Test public void syncGetRequestWithAnything() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnything(); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything", json.url()); @@ -180,7 +180,7 @@ public void syncGetRequestWithAnything() { @Test public void syncGetRequestWithAnythingWithPlus() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithPlus(); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/with+plus", json.url()); @@ -188,7 +188,7 @@ public void syncGetRequestWithAnythingWithPlus() { @Test public void syncGetRequestWithAnythingWithPathParam() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithPathParam("withpathparam"); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/withpathparam", json.url()); @@ -196,7 +196,7 @@ public void syncGetRequestWithAnythingWithPathParam() { @Test public void syncGetRequestWithAnythingWithPathParamWithSpace() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithPathParam("with path param"); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/with path param", json.url()); @@ -204,7 +204,7 @@ public void syncGetRequestWithAnythingWithPathParamWithSpace() { @Test public void syncGetRequestWithAnythingWithPathParamWithPlus() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithPathParam("with+path+param"); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/with+path+param", json.url()); @@ -212,7 +212,7 @@ public void syncGetRequestWithAnythingWithPathParamWithPlus() { @Test public void syncGetRequestWithAnythingWithEncodedPathParam() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithEncodedPathParam("withpathparam"); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/withpathparam", json.url()); @@ -220,7 +220,7 @@ public void syncGetRequestWithAnythingWithEncodedPathParam() { @Test public void syncGetRequestWithAnythingWithEncodedPathParamWithPercent20() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithEncodedPathParam("with%20path%20param"); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/with path param", json.url()); @@ -228,7 +228,7 @@ public void syncGetRequestWithAnythingWithEncodedPathParamWithPercent20() { @Test public void syncGetRequestWithAnythingWithEncodedPathParamWithPlus() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithEncodedPathParam("with+path+param"); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/with+path+param", json.url()); @@ -236,7 +236,7 @@ public void syncGetRequestWithAnythingWithEncodedPathParamWithPlus() { @Test public void asyncGetRequestWithAnything() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingAsync() .block(); assertNotNull(json); @@ -248,20 +248,20 @@ public void asyncGetRequestWithAnything() { private interface Service6 { @Get("anything") @ExpectedResponses({200}) - HttpBinJSON getAnything(@QueryParam("a") String a, @QueryParam("b") int b); + HttpBinJson getAnything(@QueryParam("a") String a, @QueryParam("b") int b); @Get("anything") @ExpectedResponses({200}) - HttpBinJSON getAnythingWithEncoded(@QueryParam(value = "a", encoded = true) String a, @QueryParam("b") int b); + HttpBinJson getAnythingWithEncoded(@QueryParam(value = "a", encoded = true) String a, @QueryParam("b") int b); @Get("anything") @ExpectedResponses({200}) - Mono getAnythingAsync(@QueryParam("a") String a, @QueryParam("b") int b); + Mono getAnythingAsync(@QueryParam("a") String a, @QueryParam("b") int b); } @Test public void syncGetRequestWithQueryParametersAndAnything() { - final HttpBinJSON json = createService(Service6.class) + final HttpBinJson json = createService(Service6.class) .getAnything("A", 15); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything?a=A&b=15", json.url()); @@ -269,7 +269,7 @@ public void syncGetRequestWithQueryParametersAndAnything() { @Test public void syncGetRequestWithQueryParametersAndAnythingWithPercent20() { - final HttpBinJSON json = createService(Service6.class) + final HttpBinJson json = createService(Service6.class) .getAnything("A%20Z", 15); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything?a=A%2520Z&b=15", json.url()); @@ -277,7 +277,7 @@ public void syncGetRequestWithQueryParametersAndAnythingWithPercent20() { @Test public void syncGetRequestWithQueryParametersAndAnythingWithEncodedWithPercent20() { - final HttpBinJSON json = createService(Service6.class) + final HttpBinJson json = createService(Service6.class) .getAnythingWithEncoded("x%20y", 15); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything?a=x y&b=15", json.url()); @@ -285,7 +285,7 @@ public void syncGetRequestWithQueryParametersAndAnythingWithEncodedWithPercent20 @Test public void asyncGetRequestWithQueryParametersAndAnything() { - final HttpBinJSON json = createService(Service6.class) + final HttpBinJson json = createService(Service6.class) .getAnythingAsync("A", 15) .block(); assertNotNull(json); @@ -297,16 +297,16 @@ public void asyncGetRequestWithQueryParametersAndAnything() { private interface Service7 { @Get("anything") @ExpectedResponses({200}) - HttpBinJSON getAnything(@HeaderParam("a") String a, @HeaderParam("b") int b); + HttpBinJson getAnything(@HeaderParam("a") String a, @HeaderParam("b") int b); @Get("anything") @ExpectedResponses({200}) - Mono getAnythingAsync(@HeaderParam("a") String a, @HeaderParam("b") int b); + Mono getAnythingAsync(@HeaderParam("a") String a, @HeaderParam("b") int b); } @Test public void syncGetRequestWithHeaderParametersAndAnythingReturn() { - final HttpBinJSON json = createService(Service7.class) + final HttpBinJson json = createService(Service7.class) .getAnything("A", 15); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything", json.url()); @@ -320,7 +320,7 @@ public void syncGetRequestWithHeaderParametersAndAnythingReturn() { @Test public void asyncGetRequestWithHeaderParametersAndAnything() { - final HttpBinJSON json = createService(Service7.class) + final HttpBinJson json = createService(Service7.class) .getAnythingAsync("A", 15) .block(); assertNotNull(json); @@ -338,16 +338,16 @@ public void asyncGetRequestWithHeaderParametersAndAnything() { private interface Service8 { @Post("post") @ExpectedResponses({200}) - HttpBinJSON post(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String postBody); + HttpBinJson post(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String postBody); @Post("post") @ExpectedResponses({200}) - Mono postAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String postBody); + Mono postAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String postBody); } @Test public void syncPostRequestWithStringBody() { - final HttpBinJSON json = createService(Service8.class) + final HttpBinJson json = createService(Service8.class) .post("I'm a post body!"); assertEquals(String.class, json.data().getClass()); assertEquals("I'm a post body!", json.data()); @@ -355,7 +355,7 @@ public void syncPostRequestWithStringBody() { @Test public void asyncPostRequestWithStringBody() { - final HttpBinJSON json = createService(Service8.class) + final HttpBinJson json = createService(Service8.class) .postAsync("I'm a post body!") .block(); assertEquals(String.class, json.data().getClass()); @@ -367,25 +367,25 @@ public void asyncPostRequestWithStringBody() { private interface Service9 { @Put("put") @ExpectedResponses({200}) - HttpBinJSON put(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) int putBody); + HttpBinJson put(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) int putBody); @Put("put") @ExpectedResponses({200}) - Mono putAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) int putBody); + Mono putAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) int putBody); @Put("put") @ExpectedResponses({201}) - HttpBinJSON putWithUnexpectedResponse(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); + HttpBinJson putWithUnexpectedResponse(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); @Put("put") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(MyAzureException.class) - HttpBinJSON putWithUnexpectedResponseAndExceptionType(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); + HttpBinJson putWithUnexpectedResponseAndExceptionType(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); } @Test public void syncPutRequestWithIntBody() { - final HttpBinJSON json = createService(Service9.class) + final HttpBinJson json = createService(Service9.class) .put(42); assertEquals(String.class, json.data().getClass()); assertEquals("42", json.data()); @@ -393,7 +393,7 @@ public void syncPutRequestWithIntBody() { @Test public void asyncPutRequestWithIntBody() { - final HttpBinJSON json = createService(Service9.class) + final HttpBinJson json = createService(Service9.class) .putAsync(42) .block(); assertEquals(String.class, json.data().getClass()); @@ -485,16 +485,16 @@ public void asyncCompletableHeadRequest() { private interface Service11 { @Delete("delete") @ExpectedResponses({200}) - HttpBinJSON delete(@BodyParam(ContentType.APPLICATION_JSON) boolean bodyBoolean); + HttpBinJson delete(@BodyParam(ContentType.APPLICATION_JSON) boolean bodyBoolean); @Delete("delete") @ExpectedResponses({200}) - Mono deleteAsync(@BodyParam(ContentType.APPLICATION_JSON) boolean bodyBoolean); + Mono deleteAsync(@BodyParam(ContentType.APPLICATION_JSON) boolean bodyBoolean); } @Test public void syncDeleteRequest() { - final HttpBinJSON json = createService(Service11.class) + final HttpBinJson json = createService(Service11.class) .delete(false); assertEquals(String.class, json.data().getClass()); assertEquals("false", json.data()); @@ -502,7 +502,7 @@ public void syncDeleteRequest() { @Test public void asyncDeleteRequest() { - final HttpBinJSON json = createService(Service11.class) + final HttpBinJson json = createService(Service11.class) .deleteAsync(false) .block(); assertEquals(String.class, json.data().getClass()); @@ -514,16 +514,16 @@ public void asyncDeleteRequest() { private interface Service12 { @Patch("patch") @ExpectedResponses({200}) - HttpBinJSON patch(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String bodyString); + HttpBinJson patch(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String bodyString); @Patch("patch") @ExpectedResponses({200}) - Mono patchAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String bodyString); + Mono patchAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String bodyString); } @Test public void syncPatchRequest() { - final HttpBinJSON json = createService(Service12.class) + final HttpBinJson json = createService(Service12.class) .patch("body-contents"); assertEquals(String.class, json.data().getClass()); assertEquals("body-contents", json.data()); @@ -531,7 +531,7 @@ public void syncPatchRequest() { @Test public void asyncPatchRequest() { - final HttpBinJSON json = createService(Service12.class) + final HttpBinJson json = createService(Service12.class) .patchAsync("body-contents") .block(); assertEquals(String.class, json.data().getClass()); @@ -544,17 +544,17 @@ private interface Service13 { @Get("anything") @ExpectedResponses({200}) @Headers({ "MyHeader:MyHeaderValue", "MyOtherHeader:My,Header,Value" }) - HttpBinJSON get(); + HttpBinJson get(); @Get("anything") @ExpectedResponses({200}) @Headers({ "MyHeader:MyHeaderValue", "MyOtherHeader:My,Header,Value" }) - Mono getAsync(); + Mono getAsync(); } @Test public void syncHeadersRequest() { - final HttpBinJSON json = createService(Service13.class) + final HttpBinJson json = createService(Service13.class) .get(); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything", json.url()); @@ -568,7 +568,7 @@ public void syncHeadersRequest() { @Test public void asyncHeadersRequest() { - final HttpBinJSON json = createService(Service13.class) + final HttpBinJson json = createService(Service13.class) .getAsync() .block(); assertNotNull(json); @@ -585,17 +585,17 @@ private interface Service14 { @Get("anything") @ExpectedResponses({200}) @Headers({ "MyHeader:MyHeaderValue" }) - HttpBinJSON get(); + HttpBinJson get(); @Get("anything") @ExpectedResponses({200}) @Headers({ "MyHeader:MyHeaderValue" }) - Mono getAsync(); + Mono getAsync(); } @Test public void asyncHttpsHeadersRequest() { - final HttpBinJSON json = createService(Service14.class) + final HttpBinJson json = createService(Service14.class) .getAsync() .block(); assertNotNull(json); @@ -610,7 +610,7 @@ public void asyncHttpsHeadersRequest() { private interface Service15 { @Get("anything") @ExpectedResponses({200}) - Flux get(); + Flux get(); } @Test @@ -620,7 +620,7 @@ public void service15Get() { service.get(); fail("Expected exception."); } catch (InvalidReturnTypeException e) { - assertContains(e.getMessage(), "reactor.core.publisher.Flux"); + assertContains(e.getMessage(), "reactor.core.publisher.Flux"); assertContains(e.getMessage(), "AzureProxyToRestProxyTests$Service15.get()"); } } @@ -630,17 +630,17 @@ public void service15Get() { private interface Service16 { @Put("put") @ExpectedResponses({200}) - HttpBinJSON put(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) byte[] putBody); + HttpBinJson put(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) byte[] putBody); @Put("put") @ExpectedResponses({200}) - Mono putAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) byte[] putBody); + Mono putAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) byte[] putBody); } @Test public void service16Put() { final Service16 service = createService(Service16.class); - final HttpBinJSON result = service.put(new byte[] { 0, 1, 2, 3, 4, 5 }); + final HttpBinJson result = service.put(new byte[] { 0, 1, 2, 3, 4, 5 }); assertNotNull(result); assertMatchWithHttpOrHttps("httpbin.org/put", result.url()); assertTrue(result.data() instanceof String); @@ -650,7 +650,7 @@ public void service16Put() { @Test public void service16PutAsync() { final Service16 service = createService(Service16.class); - final HttpBinJSON result = service.putAsync(new byte[] { 0, 1, 2, 3, 4, 5 }) + final HttpBinJson result = service.putAsync(new byte[] { 0, 1, 2, 3, 4, 5 }) .block(); assertNotNull(result); assertMatchWithHttpOrHttps("httpbin.org/put", result.url()); @@ -663,17 +663,17 @@ public void service16PutAsync() { private interface Service17 { @Get("get") @ExpectedResponses({200}) - HttpBinJSON get(@HostParam("hostPart1") String hostPart1, @HostParam("hostPart2") String hostPart2); + HttpBinJson get(@HostParam("hostPart1") String hostPart1, @HostParam("hostPart2") String hostPart2); @Get("get") @ExpectedResponses({200}) - Mono getAsync(@HostParam("hostPart1") String hostPart1, @HostParam("hostPart2") String hostPart2); + Mono getAsync(@HostParam("hostPart1") String hostPart1, @HostParam("hostPart2") String hostPart2); } @Test public void syncRequestWithMultipleHostParams() { final Service17 service17 = createService(Service17.class); - final HttpBinJSON result = service17.get("http", "bin"); + final HttpBinJson result = service17.get("http", "bin"); assertNotNull(result); assertMatchWithHttpOrHttps("httpbin.org/get", result.url()); } @@ -681,7 +681,7 @@ public void syncRequestWithMultipleHostParams() { @Test public void asyncRequestWithMultipleHostParams() { final Service17 service17 = createService(Service17.class); - final HttpBinJSON result = service17.getAsync("http", "bin").block(); + final HttpBinJson result = service17.getAsync("http", "bin").block(); assertNotNull(result); assertMatchWithHttpOrHttps("httpbin.org/get", result.url()); } diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/MockAzureHttpClient.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/MockAzureHttpClient.java index f2da9585b438..0c104d08c8d8 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/MockAzureHttpClient.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/MockAzureHttpClient.java @@ -11,7 +11,7 @@ import com.azure.core.http.HttpResponse; import com.azure.core.implementation.util.FluxUtil; import com.azure.core.management.AsyncOperationResource; -import com.azure.core.test.HttpBinJSON; +import com.azure.core.test.HttpBinJson; import com.azure.core.management.MockResource; import com.azure.core.management.OperationState; import com.azure.core.management.implementation.AzureAsyncOperationPollStrategy; @@ -66,7 +66,7 @@ public Mono send(HttpRequest request) { if ("HEAD".equals(request.getHttpMethod())) { response = new MockHttpResponse(request, 200, responseHeaders(), ""); } else { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString() // This is just to mimic the behavior we've seen with httpbin.org. .replace("%20", " ")); @@ -78,27 +78,27 @@ public Mono send(HttpRequest request) { final int byteCount = Integer.parseInt(byteCountString); response = new MockHttpResponse(request, 200, responseHeaders(), new byte[byteCount]); } else if (requestPathLower.equals("/delete")) { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.data(bodyToString(request)); response = new MockHttpResponse(request, 200, responseHeaders(), json); } else if (requestPathLower.equals("/get")) { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.headers(toMap(request.getHeaders())); response = new MockHttpResponse(request, 200, responseHeaders(), json); } else if (requestPathLower.equals("/patch")) { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.data(bodyToString(request)); response = new MockHttpResponse(request, 200, responseHeaders(), json); } else if (requestPathLower.equals("/post")) { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.data(bodyToString(request)); response = new MockHttpResponse(request, 200, responseHeaders(), json); } else if (requestPathLower.equals("/put")) { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.data(bodyToString(request)); response = new MockHttpResponse(request, 200, responseHeaders(), json); diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/HttpBinJSON.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/HttpBinJSON.java index 154540ce4ee2..bbdabc8b15c5 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/HttpBinJSON.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/HttpBinJSON.java @@ -10,7 +10,7 @@ /** * Maps to the JSON return values from http://httpbin.org. */ -public class HttpBinJSON { +public class HttpBinJson { @JsonProperty() private String url; diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/MyAzureException.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/MyAzureException.java index 215d2c063a59..e5a5288161ba 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/MyAzureException.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/MyAzureException.java @@ -12,14 +12,14 @@ public class MyAzureException extends HttpResponseException { * * @param message Message for the exception. * @param response HttpResponse associated with the service request exception. - * @param body HttpResponse deserialized into a {@link HttpBinJSON}. + * @param body HttpResponse deserialized into a {@link HttpBinJson}. */ - public MyAzureException(String message, HttpResponse response, HttpBinJSON body) { + public MyAzureException(String message, HttpResponse response, HttpBinJson body) { super(message, response, body); } @Override - public HttpBinJSON getValue() { - return (HttpBinJSON) super.getValue(); + public HttpBinJson getValue() { + return (HttpBinJson) super.getValue(); } } diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/MyRestException.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/MyRestException.java index 447de3ffc9f1..6ebc1b94941c 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/MyRestException.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/MyRestException.java @@ -14,12 +14,12 @@ public class MyRestException extends HttpResponseException { * @param response HttpResponse associated with the exception. * @param body Deserialized body of {@code response}. */ - public MyRestException(String message, HttpResponse response, HttpBinJSON body) { + public MyRestException(String message, HttpResponse response, HttpBinJson body) { super(message, response, body); } @Override - public HttpBinJSON getValue() { - return (HttpBinJSON) super.getValue(); + public HttpBinJson getValue() { + return (HttpBinJson) super.getValue(); } } diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/MockHttpClient.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/MockHttpClient.java index aeb8db7a325e..9ee9fd0d05fc 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/MockHttpClient.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/MockHttpClient.java @@ -3,10 +3,10 @@ package com.azure.core.test.http; -import com.azure.core.implementation.entities.HttpBinFormDataJSON; -import com.azure.core.implementation.entities.HttpBinFormDataJSON.Form; -import com.azure.core.implementation.entities.HttpBinFormDataJSON.PizzaSize; -import com.azure.core.implementation.entities.HttpBinJSON; +import com.azure.core.implementation.entities.HttpBinFormDataJson; +import com.azure.core.implementation.entities.HttpBinFormDataJson.Form; +import com.azure.core.implementation.entities.HttpBinFormDataJson.PizzaSize; +import com.azure.core.implementation.entities.HttpBinJson; import com.azure.core.http.HttpHeader; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; @@ -53,7 +53,7 @@ public Mono send(HttpRequest request) { if ("HEAD".equals(request.getHttpMethod())) { response = new MockHttpResponse(request, 200, new byte[0]); } else { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString() // This is just to mimic the behavior we've seen with httpbin.org. .replace("%20", " ")); @@ -127,24 +127,24 @@ public Mono send(HttpRequest request) { } else if (requestPathLower.equals("/unixtime")) { response = new MockHttpResponse(request, 200, RESPONSE_HEADERS, 0); } else if (requestPathLower.equals("/delete")) { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.data(createHttpBinResponseDataForRequest(request)); response = new MockHttpResponse(request, 200, json); } else if (requestPathLower.equals("/get")) { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.headers(toMap(request.getHeaders())); response = new MockHttpResponse(request, 200, json); } else if (requestPathLower.equals("/patch")) { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.data(createHttpBinResponseDataForRequest(request)); response = new MockHttpResponse(request, 200, json); } else if (requestPathLower.equals("/post")) { if (contentType != null && contentType.contains("x-www-form-urlencoded")) { Map parsed = bodyToMap(request); - final HttpBinFormDataJSON json = new HttpBinFormDataJSON(); + final HttpBinFormDataJson json = new HttpBinFormDataJson(); Form form = new Form(); form.customerName(parsed.get("custname")); form.customerEmail(parsed.get("custemail")); @@ -154,14 +154,14 @@ public Mono send(HttpRequest request) { json.form(form); response = new MockHttpResponse(request, 200, RESPONSE_HEADERS, json); } else { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.data(createHttpBinResponseDataForRequest(request)); json.headers(toMap(request.getHeaders())); response = new MockHttpResponse(request, 200, json); } } else if (requestPathLower.equals("/put")) { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.data(createHttpBinResponseDataForRequest(request)); json.headers(toMap(request.getHeaders())); diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/implementation/RestProxyTests.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/implementation/RestProxyTests.java index 4df45145b2af..52025441ac30 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/implementation/RestProxyTests.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/implementation/RestProxyTests.java @@ -28,10 +28,10 @@ import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ServiceInterface; import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.implementation.entities.HttpBinFormDataJSON; -import com.azure.core.implementation.entities.HttpBinFormDataJSON.PizzaSize; +import com.azure.core.implementation.entities.HttpBinFormDataJson; +import com.azure.core.implementation.entities.HttpBinFormDataJson.PizzaSize; import com.azure.core.implementation.entities.HttpBinHeaders; -import com.azure.core.implementation.entities.HttpBinJSON; +import com.azure.core.implementation.entities.HttpBinJson; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpHeaders; @@ -190,28 +190,28 @@ public void asyncGetRequestWithNoReturn() { private interface Service5 { @Get("anything") @ExpectedResponses({200}) - HttpBinJSON getAnything(); + HttpBinJson getAnything(); @Get("anything/with+plus") @ExpectedResponses({200}) - HttpBinJSON getAnythingWithPlus(); + HttpBinJson getAnythingWithPlus(); @Get("anything/{path}") @ExpectedResponses({200}) - HttpBinJSON getAnythingWithPathParam(@PathParam("path") String pathParam); + HttpBinJson getAnythingWithPathParam(@PathParam("path") String pathParam); @Get("anything/{path}") @ExpectedResponses({200}) - HttpBinJSON getAnythingWithEncodedPathParam(@PathParam(value = "path", encoded = true) String pathParam); + HttpBinJson getAnythingWithEncodedPathParam(@PathParam(value = "path", encoded = true) String pathParam); @Get("anything") @ExpectedResponses({200}) - Mono getAnythingAsync(); + Mono getAnythingAsync(); } @Test public void syncGetRequestWithAnything() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnything(); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything", json.url()); @@ -219,7 +219,7 @@ public void syncGetRequestWithAnything() { @Test public void syncGetRequestWithAnythingWithPlus() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithPlus(); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/with+plus", json.url()); @@ -227,7 +227,7 @@ public void syncGetRequestWithAnythingWithPlus() { @Test public void syncGetRequestWithAnythingWithPathParam() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithPathParam("withpathparam"); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/withpathparam", json.url()); @@ -235,7 +235,7 @@ public void syncGetRequestWithAnythingWithPathParam() { @Test public void syncGetRequestWithAnythingWithPathParamWithSpace() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithPathParam("with path param"); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/with path param", json.url()); @@ -243,7 +243,7 @@ public void syncGetRequestWithAnythingWithPathParamWithSpace() { @Test public void syncGetRequestWithAnythingWithPathParamWithPlus() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithPathParam("with+path+param"); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/with+path+param", json.url()); @@ -251,7 +251,7 @@ public void syncGetRequestWithAnythingWithPathParamWithPlus() { @Test public void syncGetRequestWithAnythingWithEncodedPathParam() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithEncodedPathParam("withpathparam"); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/withpathparam", json.url()); @@ -259,7 +259,7 @@ public void syncGetRequestWithAnythingWithEncodedPathParam() { @Test public void syncGetRequestWithAnythingWithEncodedPathParamWithPercent20() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithEncodedPathParam("with%20path%20param"); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/with path param", json.url()); @@ -267,7 +267,7 @@ public void syncGetRequestWithAnythingWithEncodedPathParamWithPercent20() { @Test public void syncGetRequestWithAnythingWithEncodedPathParamWithPlus() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingWithEncodedPathParam("with+path+param"); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything/with+path+param", json.url()); @@ -275,7 +275,7 @@ public void syncGetRequestWithAnythingWithEncodedPathParamWithPlus() { @Test public void asyncGetRequestWithAnything() { - final HttpBinJSON json = createService(Service5.class) + final HttpBinJson json = createService(Service5.class) .getAnythingAsync() .block(); assertNotNull(json); @@ -287,20 +287,20 @@ public void asyncGetRequestWithAnything() { private interface Service6 { @Get("anything") @ExpectedResponses({200}) - HttpBinJSON getAnything(@QueryParam("a") String a, @QueryParam("b") int b); + HttpBinJson getAnything(@QueryParam("a") String a, @QueryParam("b") int b); @Get("anything") @ExpectedResponses({200}) - HttpBinJSON getAnythingWithEncoded(@QueryParam(value = "a", encoded = true) String a, @QueryParam("b") int b); + HttpBinJson getAnythingWithEncoded(@QueryParam(value = "a", encoded = true) String a, @QueryParam("b") int b); @Get("anything") @ExpectedResponses({200}) - Mono getAnythingAsync(@QueryParam("a") String a, @QueryParam("b") int b); + Mono getAnythingAsync(@QueryParam("a") String a, @QueryParam("b") int b); } @Test public void syncGetRequestWithQueryParametersAndAnything() { - final HttpBinJSON json = createService(Service6.class) + final HttpBinJson json = createService(Service6.class) .getAnything("A", 15); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything?a=A&b=15", json.url()); @@ -308,7 +308,7 @@ public void syncGetRequestWithQueryParametersAndAnything() { @Test public void syncGetRequestWithQueryParametersAndAnythingWithPercent20() { - final HttpBinJSON json = createService(Service6.class) + final HttpBinJson json = createService(Service6.class) .getAnything("A%20Z", 15); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything?a=A%2520Z&b=15", json.url()); @@ -316,7 +316,7 @@ public void syncGetRequestWithQueryParametersAndAnythingWithPercent20() { @Test public void syncGetRequestWithQueryParametersAndAnythingWithEncodedWithPercent20() { - final HttpBinJSON json = createService(Service6.class) + final HttpBinJson json = createService(Service6.class) .getAnythingWithEncoded("x%20y", 15); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything?a=x y&b=15", json.url()); @@ -324,7 +324,7 @@ public void syncGetRequestWithQueryParametersAndAnythingWithEncodedWithPercent20 @Test public void asyncGetRequestWithQueryParametersAndAnything() { - final HttpBinJSON json = createService(Service6.class) + final HttpBinJson json = createService(Service6.class) .getAnythingAsync("A", 15) .block(); assertNotNull(json); @@ -333,7 +333,7 @@ public void asyncGetRequestWithQueryParametersAndAnything() { @Test public void syncGetRequestWithNullQueryParameter() { - final HttpBinJSON json = createService(Service6.class) + final HttpBinJson json = createService(Service6.class) .getAnything(null, 15); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything?b=15", json.url()); @@ -344,16 +344,16 @@ public void syncGetRequestWithNullQueryParameter() { private interface Service7 { @Get("anything") @ExpectedResponses({200}) - HttpBinJSON getAnything(@HeaderParam("a") String a, @HeaderParam("b") int b); + HttpBinJson getAnything(@HeaderParam("a") String a, @HeaderParam("b") int b); @Get("anything") @ExpectedResponses({200}) - Mono getAnythingAsync(@HeaderParam("a") String a, @HeaderParam("b") int b); + Mono getAnythingAsync(@HeaderParam("a") String a, @HeaderParam("b") int b); } @Test public void syncGetRequestWithHeaderParametersAndAnythingReturn() { - final HttpBinJSON json = createService(Service7.class) + final HttpBinJson json = createService(Service7.class) .getAnything("A", 15); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything", json.url()); @@ -367,7 +367,7 @@ public void syncGetRequestWithHeaderParametersAndAnythingReturn() { @Test public void asyncGetRequestWithHeaderParametersAndAnything() { - final HttpBinJSON json = createService(Service7.class) + final HttpBinJson json = createService(Service7.class) .getAnythingAsync("A", 15) .block(); assertNotNull(json); @@ -382,7 +382,7 @@ public void asyncGetRequestWithHeaderParametersAndAnything() { @Test public void syncGetRequestWithNullHeader() { - final HttpBinJSON json = createService(Service7.class) + final HttpBinJson json = createService(Service7.class) .getAnything(null, 15); final HttpHeaders headers = new HttpHeaders(json.headers()); @@ -398,16 +398,16 @@ public void syncGetRequestWithNullHeader() { private interface Service8 { @Post("post") @ExpectedResponses({200}) - HttpBinJSON post(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String postBody); + HttpBinJson post(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String postBody); @Post("post") @ExpectedResponses({200}) - Mono postAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String postBody); + Mono postAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String postBody); } @Test public void syncPostRequestWithStringBody() { - final HttpBinJSON json = createService(Service8.class) + final HttpBinJson json = createService(Service8.class) .post("I'm a post body!"); assertEquals(String.class, json.data().getClass()); assertEquals("I'm a post body!", json.data()); @@ -415,7 +415,7 @@ public void syncPostRequestWithStringBody() { @Test public void asyncPostRequestWithStringBody() { - final HttpBinJSON json = createService(Service8.class) + final HttpBinJson json = createService(Service8.class) .postAsync("I'm a post body!") .block(); assertEquals(String.class, json.data().getClass()); @@ -424,7 +424,7 @@ public void asyncPostRequestWithStringBody() { @Test public void syncPostRequestWithNullBody() { - final HttpBinJSON result = createService(Service8.class).post(null); + final HttpBinJson result = createService(Service8.class).post(null); assertEquals("", result.data()); } @@ -433,87 +433,87 @@ public void syncPostRequestWithNullBody() { private interface Service9 { @Put("put") @ExpectedResponses({200}) - HttpBinJSON put(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) int putBody); + HttpBinJson put(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) int putBody); @Put("put") @ExpectedResponses({200}) - Mono putAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) int putBody); + Mono putAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) int putBody); @Put("put") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(MyRestException.class) - HttpBinJSON putBodyAndContentLength(@BodyParam("application/octet-stream") ByteBuffer body, @HeaderParam("Content-Length") long contentLength); + HttpBinJson putBodyAndContentLength(@BodyParam("application/octet-stream") ByteBuffer body, @HeaderParam("Content-Length") long contentLength); @Put("put") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(MyRestException.class) - Mono putAsyncBodyAndContentLength(@BodyParam("application/octet-stream") Flux body, @HeaderParam("Content-Length") long contentLength); + Mono putAsyncBodyAndContentLength(@BodyParam("application/octet-stream") Flux body, @HeaderParam("Content-Length") long contentLength); @Put("put") @ExpectedResponses({201}) - HttpBinJSON putWithUnexpectedResponse(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); + HttpBinJson putWithUnexpectedResponse(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); @Put("put") @ExpectedResponses({201}) - Mono putWithUnexpectedResponseAsync( + Mono putWithUnexpectedResponseAsync( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); @Put("put") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(MyRestException.class) - HttpBinJSON putWithUnexpectedResponseAndExceptionType( + HttpBinJson putWithUnexpectedResponseAndExceptionType( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); @Put("put") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(MyRestException.class) - Mono putWithUnexpectedResponseAndExceptionTypeAsync( + Mono putWithUnexpectedResponseAndExceptionTypeAsync( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); @Put("put") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(code = {200}, value = MyRestException.class) @UnexpectedResponseExceptionType(HttpResponseException.class) - HttpBinJSON putWithUnexpectedResponseAndDeterminedExceptionType( + HttpBinJson putWithUnexpectedResponseAndDeterminedExceptionType( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); @Put("put") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(code = {200}, value = MyRestException.class) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono putWithUnexpectedResponseAndDeterminedExceptionTypeAsync( + Mono putWithUnexpectedResponseAndDeterminedExceptionTypeAsync( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); @Put("put") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(code = {400}, value = HttpResponseException.class) @UnexpectedResponseExceptionType(MyRestException.class) - HttpBinJSON putWithUnexpectedResponseAndFallthroughExceptionType( + HttpBinJson putWithUnexpectedResponseAndFallthroughExceptionType( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); @Put("put") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(code = {400}, value = HttpResponseException.class) @UnexpectedResponseExceptionType(MyRestException.class) - Mono putWithUnexpectedResponseAndFallthroughExceptionTypeAsync( + Mono putWithUnexpectedResponseAndFallthroughExceptionTypeAsync( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); @Put("put") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(code = {400}, value = MyRestException.class) - HttpBinJSON putWithUnexpectedResponseAndNoFallthroughExceptionType( + HttpBinJson putWithUnexpectedResponseAndNoFallthroughExceptionType( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); @Put("put") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(code = {400}, value = MyRestException.class) - Mono putWithUnexpectedResponseAndNoFallthroughExceptionTypeAsync( + Mono putWithUnexpectedResponseAndNoFallthroughExceptionTypeAsync( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) String putBody); } @Test public void syncPutRequestWithIntBody() { - final HttpBinJSON json = createService(Service9.class) + final HttpBinJson json = createService(Service9.class) .put(42); assertEquals(String.class, json.data().getClass()); assertEquals("42", json.data()); @@ -521,7 +521,7 @@ public void syncPutRequestWithIntBody() { @Test public void asyncPutRequestWithIntBody() { - final HttpBinJSON json = createService(Service9.class) + final HttpBinJson json = createService(Service9.class) .putAsync(42) .block(); assertEquals(String.class, json.data().getClass()); @@ -532,7 +532,7 @@ public void asyncPutRequestWithIntBody() { @Test public void syncPutRequestWithBodyAndEqualContentLength() { ByteBuffer body = ByteBuffer.wrap("test".getBytes(StandardCharsets.UTF_8)); - final HttpBinJSON json = createService(Service9.class) + final HttpBinJson json = createService(Service9.class) .putBodyAndContentLength(body, 4L); assertEquals("test", json.data()); assertEquals("application/octet-stream", json.headers().get(("Content-Type"))); @@ -834,16 +834,16 @@ public void asyncCompletableHeadRequest() { private interface Service11 { @Delete("delete") @ExpectedResponses({200}) - HttpBinJSON delete(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) boolean bodyBoolean); + HttpBinJson delete(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) boolean bodyBoolean); @Delete("delete") @ExpectedResponses({200}) - Mono deleteAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) boolean bodyBoolean); + Mono deleteAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) boolean bodyBoolean); } @Test public void syncDeleteRequest() { - final HttpBinJSON json = createService(Service11.class) + final HttpBinJson json = createService(Service11.class) .delete(false); assertEquals(String.class, json.data().getClass()); assertEquals("false", json.data()); @@ -851,7 +851,7 @@ public void syncDeleteRequest() { @Test public void asyncDeleteRequest() { - final HttpBinJSON json = createService(Service11.class) + final HttpBinJson json = createService(Service11.class) .deleteAsync(false) .block(); assertEquals(String.class, json.data().getClass()); @@ -863,16 +863,16 @@ public void asyncDeleteRequest() { private interface Service12 { @Patch("patch") @ExpectedResponses({200}) - HttpBinJSON patch(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String bodyString); + HttpBinJson patch(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String bodyString); @Patch("patch") @ExpectedResponses({200}) - Mono patchAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String bodyString); + Mono patchAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String bodyString); } @Test public void syncPatchRequest() { - final HttpBinJSON json = createService(Service12.class) + final HttpBinJson json = createService(Service12.class) .patch("body-contents"); assertEquals(String.class, json.data().getClass()); assertEquals("body-contents", json.data()); @@ -880,7 +880,7 @@ public void syncPatchRequest() { @Test public void asyncPatchRequest() { - final HttpBinJSON json = createService(Service12.class) + final HttpBinJson json = createService(Service12.class) .patchAsync("body-contents") .block(); assertEquals(String.class, json.data().getClass()); @@ -893,17 +893,17 @@ private interface Service13 { @Get("anything") @ExpectedResponses({200}) @Headers({ "MyHeader:MyHeaderValue", "MyOtherHeader:My,Header,Value" }) - HttpBinJSON get(); + HttpBinJson get(); @Get("anything") @ExpectedResponses({200}) @Headers({ "MyHeader:MyHeaderValue", "MyOtherHeader:My,Header,Value" }) - Mono getAsync(); + Mono getAsync(); } @Test public void syncHeadersRequest() { - final HttpBinJSON json = createService(Service13.class) + final HttpBinJson json = createService(Service13.class) .get(); assertNotNull(json); assertMatchWithHttpOrHttps("httpbin.org/anything", json.url()); @@ -917,7 +917,7 @@ public void syncHeadersRequest() { @Test public void asyncHeadersRequest() { - final HttpBinJSON json = createService(Service13.class) + final HttpBinJson json = createService(Service13.class) .getAsync() .block(); assertNotNull(json); @@ -934,17 +934,17 @@ private interface Service14 { @Get("anything") @ExpectedResponses({200}) @Headers({ "MyHeader:MyHeaderValue" }) - HttpBinJSON get(); + HttpBinJson get(); @Get("anything") @ExpectedResponses({200}) @Headers({ "MyHeader:MyHeaderValue" }) - Mono getAsync(); + Mono getAsync(); } @Test public void asyncHttpsHeadersRequest() { - final HttpBinJSON json = createService(Service14.class) + final HttpBinJson json = createService(Service14.class) .getAsync() .block(); assertNotNull(json); @@ -959,18 +959,18 @@ public void asyncHttpsHeadersRequest() { private interface Service16 { @Put("put") @ExpectedResponses({200}) - HttpBinJSON putByteArray(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) byte[] bytes); + HttpBinJson putByteArray(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) byte[] bytes); @Put("put") @ExpectedResponses({200}) - Mono putByteArrayAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) byte[] bytes); + Mono putByteArrayAsync(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) byte[] bytes); } @Test public void service16Put() throws Exception { final Service16 service16 = createService(Service16.class); final byte[] expectedBytes = new byte[] { 1, 2, 3, 4 }; - final HttpBinJSON httpBinJSON = service16.putByteArray(expectedBytes); + final HttpBinJson httpBinJSON = service16.putByteArray(expectedBytes); // httpbin sends the data back as a string like "\u0001\u0002\u0003\u0004" assertTrue(httpBinJSON.data() instanceof String); @@ -984,7 +984,7 @@ public void service16Put() throws Exception { public void service16PutAsync() throws Exception { final Service16 service16 = createService(Service16.class); final byte[] expectedBytes = new byte[] { 1, 2, 3, 4 }; - final HttpBinJSON httpBinJSON = service16.putByteArrayAsync(expectedBytes) + final HttpBinJson httpBinJSON = service16.putByteArrayAsync(expectedBytes) .block(); assertTrue(httpBinJSON.data() instanceof String); @@ -998,17 +998,17 @@ public void service16PutAsync() throws Exception { private interface Service17 { @Get("get") @ExpectedResponses({200}) - HttpBinJSON get(@HostParam("hostPart1") String hostPart1, @HostParam("hostPart2") String hostPart2); + HttpBinJson get(@HostParam("hostPart1") String hostPart1, @HostParam("hostPart2") String hostPart2); @Get("get") @ExpectedResponses({200}) - Mono getAsync(@HostParam("hostPart1") String hostPart1, @HostParam("hostPart2") String hostPart2); + Mono getAsync(@HostParam("hostPart1") String hostPart1, @HostParam("hostPart2") String hostPart2); } @Test public void syncRequestWithMultipleHostParams() { final Service17 service17 = createService(Service17.class); - final HttpBinJSON result = service17.get("http", "bin"); + final HttpBinJson result = service17.get("http", "bin"); assertNotNull(result); assertMatchWithHttpOrHttps("httpbin.org/get", result.url()); } @@ -1016,7 +1016,7 @@ public void syncRequestWithMultipleHostParams() { @Test public void asyncRequestWithMultipleHostParams() { final Service17 service17 = createService(Service17.class); - final HttpBinJSON result = service17.getAsync("http", "bin").block(); + final HttpBinJson result = service17.getAsync("http", "bin").block(); assertNotNull(result); assertMatchWithHttpOrHttps("httpbin.org/get", result.url()); } @@ -1105,304 +1105,304 @@ public void service18GetStatus500WithExpectedResponse500() { @ServiceInterface(name = "Service19") private interface Service19 { @Put("put") - HttpBinJSON putWithNoContentTypeAndStringBody(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String body); + HttpBinJson putWithNoContentTypeAndStringBody(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String body); @Put("put") - HttpBinJSON putWithNoContentTypeAndByteArrayBody(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) byte[] body); + HttpBinJson putWithNoContentTypeAndByteArrayBody(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) byte[] body); @Put("put") - HttpBinJSON putWithHeaderApplicationJsonContentTypeAndStringBody( + HttpBinJson putWithHeaderApplicationJsonContentTypeAndStringBody( @BodyParam(ContentType.APPLICATION_JSON) String body); @Put("put") @Headers({ "Content-Type: application/json" }) - HttpBinJSON putWithHeaderApplicationJsonContentTypeAndByteArrayBody( + HttpBinJson putWithHeaderApplicationJsonContentTypeAndByteArrayBody( @BodyParam(ContentType.APPLICATION_JSON) byte[] body); @Put("put") @Headers({ "Content-Type: application/json; charset=utf-8" }) - HttpBinJSON putWithHeaderApplicationJsonContentTypeAndCharsetAndStringBody( + HttpBinJson putWithHeaderApplicationJsonContentTypeAndCharsetAndStringBody( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) String body); @Put("put") @Headers({ "Content-Type: application/octet-stream" }) - HttpBinJSON putWithHeaderApplicationOctetStreamContentTypeAndStringBody( + HttpBinJson putWithHeaderApplicationOctetStreamContentTypeAndStringBody( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) String body); @Put("put") @Headers({ "Content-Type: application/octet-stream" }) - HttpBinJSON putWithHeaderApplicationOctetStreamContentTypeAndByteArrayBody( + HttpBinJson putWithHeaderApplicationOctetStreamContentTypeAndByteArrayBody( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) byte[] body); @Put("put") - HttpBinJSON putWithBodyParamApplicationJsonContentTypeAndStringBody( + HttpBinJson putWithBodyParamApplicationJsonContentTypeAndStringBody( @BodyParam(ContentType.APPLICATION_JSON) String body); @Put("put") - HttpBinJSON putWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBody( + HttpBinJson putWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBody( @BodyParam(ContentType.APPLICATION_JSON + "; charset=utf-8") String body); @Put("put") - HttpBinJSON putWithBodyParamApplicationJsonContentTypeAndByteArrayBody( + HttpBinJson putWithBodyParamApplicationJsonContentTypeAndByteArrayBody( @BodyParam(ContentType.APPLICATION_JSON) byte[] body); @Put("put") - HttpBinJSON putWithBodyParamApplicationOctetStreamContentTypeAndStringBody( + HttpBinJson putWithBodyParamApplicationOctetStreamContentTypeAndStringBody( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) String body); @Put("put") - HttpBinJSON putWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBody( + HttpBinJson putWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBody( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) byte[] body); } @Test public void service19PutWithNoContentTypeAndStringBodyWithNullBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithNoContentTypeAndStringBody(null); assertEquals("", result.data()); } @Test public void service19PutWithNoContentTypeAndStringBodyWithEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithNoContentTypeAndStringBody(""); assertEquals("", result.data()); } @Test public void service19PutWithNoContentTypeAndStringBodyWithNonEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithNoContentTypeAndStringBody("hello"); assertEquals("hello", result.data()); } @Test public void service19PutWithNoContentTypeAndByteArrayBodyWithNullBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithNoContentTypeAndByteArrayBody(null); assertEquals("", result.data()); } @Test public void service19PutWithNoContentTypeAndByteArrayBodyWithEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithNoContentTypeAndByteArrayBody(new byte[0]); assertEquals("", result.data()); } @Test public void service19PutWithNoContentTypeAndByteArrayBodyWithNonEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithNoContentTypeAndByteArrayBody(new byte[] { 0, 1, 2, 3, 4 }); assertEquals(new String(new byte[] { 0, 1, 2, 3, 4 }), result.data()); } @Test public void service19PutWithHeaderApplicationJsonContentTypeAndStringBodyWithNullBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationJsonContentTypeAndStringBody(null); assertEquals("", result.data()); } @Test public void service19PutWithHeaderApplicationJsonContentTypeAndStringBodyWithEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationJsonContentTypeAndStringBody(""); assertEquals("\"\"", result.data()); } @Test public void service19PutWithHeaderApplicationJsonContentTypeAndStringBodyWithNonEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationJsonContentTypeAndStringBody("soups and stuff"); assertEquals("\"soups and stuff\"", result.data()); } @Test public void service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithNullBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationJsonContentTypeAndByteArrayBody(null); assertEquals("", result.data()); } @Test public void service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationJsonContentTypeAndByteArrayBody(new byte[0]); assertEquals("\"\"", result.data()); } @Test public void service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithNonEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationJsonContentTypeAndByteArrayBody(new byte[] { 0, 1, 2, 3, 4 }); assertEquals("\"AAECAwQ=\"", result.data()); } @Test public void service19PutWithHeaderApplicationJsonContentTypeAndCharsetAndStringBodyWithNullBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationJsonContentTypeAndCharsetAndStringBody(null); assertEquals("", result.data()); } @Test public void service19PutWithHeaderApplicationJsonContentTypeAndCharsetAndStringBodyWithEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationJsonContentTypeAndCharsetAndStringBody(""); assertEquals("", result.data()); } @Test public void service19PutWithHeaderApplicationJsonContentTypeAndCharsetAndStringBodyWithNonEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationJsonContentTypeAndCharsetAndStringBody("soups and stuff"); assertEquals("soups and stuff", result.data()); } @Test public void service19PutWithHeaderApplicationOctetStreamContentTypeAndStringBodyWithNullBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationOctetStreamContentTypeAndStringBody(null); assertEquals("", result.data()); } @Test public void service19PutWithHeaderApplicationOctetStreamContentTypeAndStringBodyWithEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationOctetStreamContentTypeAndStringBody(""); assertEquals("", result.data()); } @Test public void service19PutWithHeaderApplicationOctetStreamContentTypeAndStringBodyWithNonEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationOctetStreamContentTypeAndStringBody("penguins"); assertEquals("penguins", result.data()); } @Test public void service19PutWithHeaderApplicationOctetStreamContentTypeAndByteArrayBodyWithNullBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationOctetStreamContentTypeAndByteArrayBody(null); assertEquals("", result.data()); } @Test public void service19PutWithHeaderApplicationOctetStreamContentTypeAndByteArrayBodyWithEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationOctetStreamContentTypeAndByteArrayBody(new byte[0]); assertEquals("", result.data()); } @Test public void service19PutWithHeaderApplicationOctetStreamContentTypeAndByteArrayBodyWithNonEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithHeaderApplicationOctetStreamContentTypeAndByteArrayBody(new byte[] { 0, 1, 2, 3, 4 }); assertEquals(new String(new byte[] { 0, 1, 2, 3, 4 }), result.data()); } @Test public void service19PutWithBodyParamApplicationJsonContentTypeAndStringBodyWithNullBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationJsonContentTypeAndStringBody(null); assertEquals("", result.data()); } @Test public void service19PutWithBodyParamApplicationJsonContentTypeAndStringBodyWithEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationJsonContentTypeAndStringBody(""); assertEquals("\"\"", result.data()); } @Test public void service19PutWithBodyParamApplicationJsonContentTypeAndStringBodyWithNonEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationJsonContentTypeAndStringBody("soups and stuff"); assertEquals("\"soups and stuff\"", result.data()); } @Test public void service19PutWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBodyWithNullBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBody(null); assertEquals("", result.data()); } @Test public void service19PutWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBodyWithEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBody(""); assertEquals("\"\"", result.data()); } @Test public void service19PutWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBodyWithNonEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBody("soups and stuff"); assertEquals("\"soups and stuff\"", result.data()); } @Test public void service19PutWithBodyParamApplicationJsonContentTypeAndByteArrayBodyWithNullBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationJsonContentTypeAndByteArrayBody(null); assertEquals("", result.data()); } @Test public void service19PutWithBodyParamApplicationJsonContentTypeAndByteArrayBodyWithEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationJsonContentTypeAndByteArrayBody(new byte[0]); assertEquals("\"\"", result.data()); } @Test public void service19PutWithBodyParamApplicationJsonContentTypeAndByteArrayBodyWithNonEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationJsonContentTypeAndByteArrayBody(new byte[] { 0, 1, 2, 3, 4 }); assertEquals("\"AAECAwQ=\"", result.data()); } @Test public void service19PutWithBodyParamApplicationOctetStreamContentTypeAndStringBodyWithNullBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationOctetStreamContentTypeAndStringBody(null); assertEquals("", result.data()); } @Test public void service19PutWithBodyParamApplicationOctetStreamContentTypeAndStringBodyWithEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationOctetStreamContentTypeAndStringBody(""); assertEquals("", result.data()); } @Test public void service19PutWithBodyParamApplicationOctetStreamContentTypeAndStringBodyWithNonEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationOctetStreamContentTypeAndStringBody("penguins"); assertEquals("penguins", result.data()); } @Test public void service19PutWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBodyWithNullBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBody(null); assertEquals("", result.data()); } @Test public void service19PutWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBodyWithEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBody(new byte[0]); assertEquals("", result.data()); } @Test public void service19PutWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBodyWithNonEmptyBody() { - final HttpBinJSON result = createService(Service19.class) + final HttpBinJson result = createService(Service19.class) .putWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBody(new byte[] { 0, 1, 2, 3, 4 }); assertEquals(new String(new byte[] { 0, 1, 2, 3, 4 }), result.data()); } @@ -1423,7 +1423,7 @@ private interface Service20 { ResponseBase putOnlyHeaders(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String body); @Put("put") - ResponseBase putBodyAndHeaders( + ResponseBase putBodyAndHeaders( @BodyParam(ContentType.APPLICATION_OCTET_STREAM) String body); @Get("bytes/100") @@ -1433,7 +1433,7 @@ ResponseBase putBodyAndHeaders( Response getVoidResponse(); @Put("put") - Response putBody(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String body); + Response putBody(@BodyParam(ContentType.APPLICATION_OCTET_STREAM) String body); } @Test @@ -1511,13 +1511,13 @@ public void service20PutOnlyHeaders() { @Test public void service20PutBodyAndHeaders() { - final ResponseBase response = createService(Service20.class) + final ResponseBase response = createService(Service20.class) .putBodyAndHeaders("body string"); assertNotNull(response); assertEquals(200, response.getStatusCode()); - final HttpBinJSON body = response.getValue(); + final HttpBinJson body = response.getValue(); assertNotNull(body); assertMatchWithHttpOrHttps("httpbin.org/put", body.url()); assertEquals("body string", body.data()); @@ -1540,11 +1540,11 @@ public void service20GetVoidResponse() { @Test public void service20GetResponseBody() { - final Response response = createService(Service20.class).putBody("body string"); + final Response response = createService(Service20.class).putBody("body string"); assertNotNull(response); assertEquals(200, response.getStatusCode()); - final HttpBinJSON body = response.getValue(); + final HttpBinJson body = response.getValue(); assertNotNull(body); assertMatchWithHttpOrHttps("httpbin.org/put", body.url()); assertEquals("body string", body.data()); @@ -1562,7 +1562,7 @@ interface UnexpectedOKService { } @Test - public void unexpectedHTTPOK() { + public void unexpectedHttpOK() { try { createService(UnexpectedOKService.class).getBytes(); fail(); @@ -1623,8 +1623,8 @@ public void rawFlowableDownloadTest() { @ServiceInterface(name = "FlowableUploadService") interface FlowableUploadService { @Put("/put") - Response put(@BodyParam("text/plain") Flux content, - @HeaderParam("Content-Length") long contentLength); + Response put(@BodyParam("text/plain") Flux content, + @HeaderParam("Content-Length") long contentLength); } @Test @@ -1642,7 +1642,7 @@ public void fluxUploadTest() throws Exception { .policies(new HttpLoggingPolicy(HttpLogDetailLevel.BODY_AND_HEADERS, true)) .build(); // - Response response = RestProxy + Response response = RestProxy .create(FlowableUploadService.class, httpPipeline, SERIALIZER).put(stream, Files.size(filePath)); assertEquals("The quick brown fox jumps over the lazy dog", response.getValue().data()); @@ -1652,7 +1652,7 @@ public void fluxUploadTest() throws Exception { public void segmentUploadTest() throws Exception { Path filePath = Paths.get(getClass().getClassLoader().getResource("upload.txt").toURI()); AsynchronousFileChannel fileChannel = AsynchronousFileChannel.open(filePath, StandardOpenOption.READ); - Response response = createService(FlowableUploadService.class) + Response response = createService(FlowableUploadService.class) .put(FluxUtil.readFile(fileChannel, 4, 15), 15); assertEquals("quick brown fox", response.getValue().data()); @@ -1691,7 +1691,7 @@ public void service23GetBytes() { @ServiceInterface(name = "Service24") interface Service24 { @Put("put") - HttpBinJSON put(@HeaderParam("ABC") Map headerCollection); + HttpBinJson put(@HeaderParam("ABC") Map headerCollection); } @Test @@ -1699,7 +1699,7 @@ public void service24Put() { final Map headerCollection = new HashMap<>(); headerCollection.put("DEF", "GHIJ"); headerCollection.put("123", "45"); - final HttpBinJSON result = createService(Service24.class) + final HttpBinJson result = createService(Service24.class) .put(headerCollection); assertNotNull(result.headers()); final HttpHeaders resultHeaders = new HttpHeaders(result.headers()); @@ -1711,13 +1711,13 @@ public void service24Put() { @ServiceInterface(name = "Service25") interface Service25 { @Get("anything") - HttpBinJSON get(); + HttpBinJson get(); @Get("anything") - Mono getAsync(); + Mono getAsync(); @Get("anything") - Mono> getBodyResponseAsync(); + Mono> getBodyResponseAsync(); } @Test(expected = HttpResponseException.class) @@ -1746,15 +1746,15 @@ public void testSingleBodyResponseMissingDecodingPolicyCausesException() { @ServiceInterface(name = "Service26") interface Service26 { @Post("post") - HttpBinFormDataJSON postForm(@FormParam("custname") String name, @FormParam("custtel") String telephone, - @FormParam("custemail") String email, @FormParam("size") PizzaSize size, - @FormParam("toppings") List toppings); + HttpBinFormDataJson postForm(@FormParam("custname") String name, @FormParam("custtel") String telephone, + @FormParam("custemail") String email, @FormParam("size") PizzaSize size, + @FormParam("toppings") List toppings); } @Test public void postUrlFormEncoded() { Service26 service = createService(Service26.class); - HttpBinFormDataJSON response = service.postForm("Foo", "123", "foo@bar.com", PizzaSize.LARGE, Arrays.asList("Bacon", "Onion")); + HttpBinFormDataJson response = service.postForm("Foo", "123", "foo@bar.com", PizzaSize.LARGE, Arrays.asList("Bacon", "Onion")); assertNotNull(response); assertNotNull(response.form()); assertEquals("Foo", response.form().customerName()); diff --git a/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java b/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java index b7a8dafb6c4b..1cfada3be13f 100644 --- a/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java +++ b/sdk/core/azure-core-test/src/test/java/com/azure/core/test/implementation/RestProxyWithMockTests.java @@ -17,7 +17,7 @@ import com.azure.core.annotation.Post; import com.azure.core.annotation.ReturnValueWireType; import com.azure.core.annotation.ServiceInterface; -import com.azure.core.implementation.entities.HttpBinJSON; +import com.azure.core.implementation.entities.HttpBinJson; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpHeaders; @@ -174,7 +174,7 @@ public void service1GetDateTimeUnix() { interface ServiceErrorWithCharsetService { @Get("/get") @ExpectedResponses({400}) - HttpBinJSON get(); + HttpBinJson get(); } @Test @@ -201,7 +201,7 @@ public Mono send(HttpRequest request) { } @Test - public void serviceErrorWithResponseContentTypeBadJSON() { + public void serviceErrorWithResponseContentTypeBadJson() { ServiceErrorWithCharsetService service = RestProxy.create( ServiceErrorWithCharsetService.class, new HttpPipelineBuilder().httpClient(new SimpleMockHttpClient() { @@ -247,7 +247,7 @@ public Mono send(HttpRequest request) { } @Test - public void serviceErrorWithResponseContentTypeCharsetBadJSON() { + public void serviceErrorWithResponseContentTypeCharsetBadJson() { ServiceErrorWithCharsetService service = RestProxy.create( ServiceErrorWithCharsetService.class, new HttpPipelineBuilder().httpClient(new SimpleMockHttpClient() { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HostPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HostPolicy.java index 25ca980904a5..19d9f0214c6e 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HostPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HostPolicy.java @@ -36,7 +36,7 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN Mono result; final UrlBuilder urlBuilder = UrlBuilder.parse(context.getHttpRequest().getUrl()); try { - context.getHttpRequest().setUrl(urlBuilder.setHost(host).toURL()); + context.getHttpRequest().setUrl(urlBuilder.setHost(host).toUrl()); result = next.process(); } catch (MalformedURLException e) { result = Mono.error(e); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/PortPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/PortPolicy.java index 665e29d67662..ea4aee3c86b5 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/PortPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/PortPolicy.java @@ -38,7 +38,7 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN logger.info("Changing port to {}", port); try { - context.getHttpRequest().setUrl(urlBuilder.setPort(port).toURL()); + context.getHttpRequest().setUrl(urlBuilder.setPort(port).toUrl()); } catch (MalformedURLException e) { return Mono.error(e); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/ProtocolPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/ProtocolPolicy.java index 0b618d260287..4e005b55cd37 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/ProtocolPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/ProtocolPolicy.java @@ -38,7 +38,7 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN logger.info("Setting protocol to {}", protocol); try { - context.getHttpRequest().setUrl(urlBuilder.setScheme(protocol).toURL()); + context.getHttpRequest().setUrl(urlBuilder.setScheme(protocol).toUrl()); } catch (MalformedURLException e) { return Mono.error(e); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/RestProxy.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/RestProxy.java index 3eb5f24e3ef5..36e9ae8631b2 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/RestProxy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/RestProxy.java @@ -260,7 +260,7 @@ private HttpRequest createHttpRequest(SwaggerMethodParser methodParser, Object[] urlBuilder.setQueryParameter(queryParameter.getName(), queryParameter.getEncodedValue()); } - final URL url = urlBuilder.toURL(); + final URL url = urlBuilder.toUrl(); final HttpRequest request = configRequest(new HttpRequest(methodParser.getHttpMethod(), url), methodParser, args); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/entities/HttpBinFormDataJSON.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/entities/HttpBinFormDataJSON.java index e3ba0e47b81e..9c5037807fc0 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/entities/HttpBinFormDataJSON.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/entities/HttpBinFormDataJSON.java @@ -11,7 +11,7 @@ /** * Maps to the JSON return values from http://httpbin.org. */ -public class HttpBinFormDataJSON { +public class HttpBinFormDataJson { @JsonProperty private String url; @JsonProperty diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/entities/HttpBinJSON.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/entities/HttpBinJSON.java index 8fe0dfa84e7d..9f87acb391b9 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/entities/HttpBinJSON.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/entities/HttpBinJSON.java @@ -10,7 +10,7 @@ /** * Maps to the JSON return values from http://httpbin.org. */ -public class HttpBinJSON { +public class HttpBinJson { @JsonProperty() private String url; diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/UrlBuilder.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/UrlBuilder.java index 917ae12c7674..fa0f5fc21911 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/UrlBuilder.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/UrlBuilder.java @@ -243,7 +243,7 @@ private UrlBuilder with(String text, UrlTokenizerState startState) { * @return The URL that is being built. * @throws MalformedURLException if the URL is not fully formed. */ - public URL toURL() throws MalformedURLException { + public URL toUrl() throws MalformedURLException { return new URL(toString()); } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/MyOtherRestException.java b/sdk/core/azure-core/src/test/java/com/azure/core/MyOtherRestException.java index 1f0bb8fb5dae..f9c7f952f64d 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/MyOtherRestException.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/MyOtherRestException.java @@ -3,7 +3,7 @@ package com.azure.core; -import com.azure.core.implementation.entities.HttpBinJSON; +import com.azure.core.implementation.entities.HttpBinJson; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpResponse; @@ -15,12 +15,12 @@ public class MyOtherRestException extends HttpResponseException { * @param response HttpResponse associated with the exception. * @param body Deserialized body of {@code response}. */ - public MyOtherRestException(String message, HttpResponse response, HttpBinJSON body) { + public MyOtherRestException(String message, HttpResponse response, HttpBinJson body) { super(message, response, body); } @Override - public HttpBinJSON getValue() { - return (HttpBinJSON) super.getValue(); + public HttpBinJson getValue() { + return (HttpBinJson) super.getValue(); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/MyRestException.java b/sdk/core/azure-core/src/test/java/com/azure/core/MyRestException.java index 4bc831a6df84..5c1c4739d28f 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/MyRestException.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/MyRestException.java @@ -3,7 +3,7 @@ package com.azure.core; -import com.azure.core.implementation.entities.HttpBinJSON; +import com.azure.core.implementation.entities.HttpBinJson; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpResponse; @@ -15,12 +15,12 @@ public class MyRestException extends HttpResponseException { * @param response HttpResponse associated with the exception. * @param body Deserialized body of {@code response}. */ - public MyRestException(String message, HttpResponse response, HttpBinJSON body) { + public MyRestException(String message, HttpResponse response, HttpBinJson body) { super(message, response, body); } @Override - public HttpBinJSON getValue() { - return (HttpBinJSON) super.getValue(); + public HttpBinJson getValue() { + return (HttpBinJson) super.getValue(); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/MockHttpClient.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/MockHttpClient.java index a1cd9fc3becf..eacdd20fe343 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/MockHttpClient.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/MockHttpClient.java @@ -3,10 +3,10 @@ package com.azure.core.http.clients; -import com.azure.core.implementation.entities.HttpBinFormDataJSON; -import com.azure.core.implementation.entities.HttpBinFormDataJSON.Form; -import com.azure.core.implementation.entities.HttpBinFormDataJSON.PizzaSize; -import com.azure.core.implementation.entities.HttpBinJSON; +import com.azure.core.implementation.entities.HttpBinFormDataJson; +import com.azure.core.implementation.entities.HttpBinFormDataJson.Form; +import com.azure.core.implementation.entities.HttpBinFormDataJson.PizzaSize; +import com.azure.core.implementation.entities.HttpBinJson; import com.azure.core.http.HttpHeader; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; @@ -55,7 +55,7 @@ public Mono send(HttpRequest request) { if ("HEAD".equals(request.getHttpMethod())) { response = new MockHttpResponse(request, 200, new byte[0]); } else { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString() // This is just to mimic the behavior we've seen with httpbin.org. .replace("%20", " ")); @@ -129,24 +129,24 @@ public Mono send(HttpRequest request) { } else if (requestPathLower.equals("/unixtime")) { response = new MockHttpResponse(request, 200, RESPONSE_HEADERS, 0); } else if (requestPathLower.equals("/delete")) { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.data(createHttpBinResponseDataForRequest(request)); response = new MockHttpResponse(request, 200, json); } else if (requestPathLower.equals("/get")) { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.headers(toMap(request.getHeaders())); response = new MockHttpResponse(request, 200, json); } else if (requestPathLower.equals("/patch")) { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.data(createHttpBinResponseDataForRequest(request)); response = new MockHttpResponse(request, 200, json); } else if (requestPathLower.equals("/post")) { if (contentType != null && contentType.contains("x-www-form-urlencoded")) { Map parsed = bodyToMap(request); - final HttpBinFormDataJSON json = new HttpBinFormDataJSON(); + final HttpBinFormDataJson json = new HttpBinFormDataJson(); Form form = new Form(); form.customerName(parsed.get("custname")); form.customerEmail(parsed.get("custemail")); @@ -156,14 +156,14 @@ public Mono send(HttpRequest request) { json.form(form); response = new MockHttpResponse(request, 200, RESPONSE_HEADERS, json); } else { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.data(createHttpBinResponseDataForRequest(request)); json.headers(toMap(request.getHeaders())); response = new MockHttpResponse(request, 200, json); } } else if (requestPathLower.equals("/put")) { - final HttpBinJSON json = new HttpBinJSON(); + final HttpBinJson json = new HttpBinJson(); json.url(request.getUrl().toString()); json.data(createHttpBinResponseDataForRequest(request)); json.headers(toMap(request.getHeaders())); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyXMLTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyXMLTests.java index c61ecbbfd9cf..69e07abf0dae 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyXMLTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyXMLTests.java @@ -40,7 +40,7 @@ import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; -public class RestProxyXMLTests { +public class RestProxyXmlTests { static class MockXMLHTTPClient implements HttpClient { private HttpResponse response(HttpRequest request, String resource) throws IOException, URISyntaxException { URL url = getClass().getClassLoader().getResource(resource); @@ -76,7 +76,7 @@ interface MyXMLService { } @Test - public void canReadXMLResponse() throws Exception { + public void canReadXmlResponse() throws Exception { // final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new MockXMLHTTPClient()) @@ -109,7 +109,7 @@ public Mono send(HttpRequest request) { } @Test - public void canWriteXMLRequest() throws Exception { + public void canWriteXmlRequest() throws Exception { URL url = getClass().getClassLoader().getResource("GetContainerACLs.xml"); byte[] bytes = Files.readAllBytes(Paths.get(url.toURI())); HttpRequest request = new HttpRequest(HttpMethod.PUT, new URL("http://unused/SetContainerACLs")); @@ -163,7 +163,7 @@ public interface MyXMLServiceWithAttributes { } @Test - public void canDeserializeXMLWithAttributes() throws Exception { + public void canDeserializeXmlWithAttributes() throws Exception { JacksonAdapter serializer = new JacksonAdapter(); // final HttpPipeline pipeline = new HttpPipelineBuilder() diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/SwaggerMethodParserTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/SwaggerMethodParserTests.java index 9f358bcb61c4..7b384a27b805 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/SwaggerMethodParserTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/SwaggerMethodParserTests.java @@ -8,7 +8,7 @@ import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.Patch; import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.implementation.entities.HttpBinJSON; +import com.azure.core.implementation.entities.HttpBinJson; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpMethod; import com.azure.core.implementation.exception.MissingRequiredAnnotationException; @@ -73,7 +73,7 @@ public void withExpectedResponseAndUnexpectedResponseExceptionType() throws IOEx assertEquals(HttpMethod.PATCH, methodParser.getHttpMethod()); assertArrayEquals(new int[] { 200 }, methodParser.getExpectedStatusCodes()); assertEquals(MyRestException.class, methodParser.getUnexpectedException(-1).getExceptionType()); - assertEquals(HttpBinJSON.class, methodParser.getUnexpectedException(-1).getExceptionBodyType()); + assertEquals(HttpBinJson.class, methodParser.getUnexpectedException(-1).getExceptionBodyType()); assertEquals(false, methodParser.setHeaders(null).iterator().hasNext()); assertEquals("https", methodParser.setScheme(null)); assertEquals("raw.host.com", methodParser.setHost(null)); @@ -99,7 +99,7 @@ public void withExpectedResponseAndMappedUnexpectedResponseExceptionTypeWithFall assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(400).getExceptionType()); assertEquals(Object.class, methodParser.getUnexpectedException(400).getExceptionBodyType()); assertEquals(MyRestException.class, methodParser.getUnexpectedException(-1).getExceptionType()); - assertEquals(HttpBinJSON.class, methodParser.getUnexpectedException(-1).getExceptionBodyType()); + assertEquals(HttpBinJson.class, methodParser.getUnexpectedException(-1).getExceptionBodyType()); assertEquals(false, methodParser.setHeaders(null).iterator().hasNext()); assertEquals("https", methodParser.setScheme(null)); assertEquals("raw.host.com", methodParser.setHost(null)); @@ -122,7 +122,7 @@ public void withExpectedResponseAndMappedUnexpectedResponseExceptionTypeWithoutF assertEquals(HttpMethod.PATCH, methodParser.getHttpMethod()); assertArrayEquals(new int[] { 200 }, methodParser.getExpectedStatusCodes()); assertEquals(MyRestException.class, methodParser.getUnexpectedException(400).getExceptionType()); - assertEquals(HttpBinJSON.class, methodParser.getUnexpectedException(400).getExceptionBodyType()); + assertEquals(HttpBinJson.class, methodParser.getUnexpectedException(400).getExceptionBodyType()); assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(-1).getExceptionType()); assertEquals(Object.class, methodParser.getUnexpectedException(-1).getExceptionBodyType()); assertEquals(false, methodParser.setHeaders(null).iterator().hasNext()); @@ -149,15 +149,15 @@ public void withExpectedResponseAndMultipleMappedUnexpectedResponseExceptionType assertEquals(HttpMethod.PATCH, methodParser.getHttpMethod()); assertArrayEquals(new int[] { 200 }, methodParser.getExpectedStatusCodes()); assertEquals(MyRestException.class, methodParser.getUnexpectedException(400).getExceptionType()); - assertEquals(HttpBinJSON.class, methodParser.getUnexpectedException(400).getExceptionBodyType()); + assertEquals(HttpBinJson.class, methodParser.getUnexpectedException(400).getExceptionBodyType()); assertEquals(MyRestException.class, methodParser.getUnexpectedException(401).getExceptionType()); - assertEquals(HttpBinJSON.class, methodParser.getUnexpectedException(401).getExceptionBodyType()); + assertEquals(HttpBinJson.class, methodParser.getUnexpectedException(401).getExceptionBodyType()); assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(404).getExceptionType()); assertEquals(Object.class, methodParser.getUnexpectedException(404).getExceptionBodyType()); assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(409).getExceptionType()); assertEquals(Object.class, methodParser.getUnexpectedException(409).getExceptionBodyType()); assertEquals(MyOtherRestException.class, methodParser.getUnexpectedException(-1).getExceptionType()); - assertEquals(HttpBinJSON.class, methodParser.getUnexpectedException(-1).getExceptionBodyType()); + assertEquals(HttpBinJson.class, methodParser.getUnexpectedException(-1).getExceptionBodyType()); assertEquals(false, methodParser.setHeaders(null).iterator().hasNext()); assertEquals("https", methodParser.setScheme(null)); assertEquals("raw.host.com", methodParser.setHost(null)); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/http/UrlBuilderTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/http/UrlBuilderTests.java index ec8b91cd0aea..49ac3f0b48df 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/http/UrlBuilderTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/http/UrlBuilderTests.java @@ -719,13 +719,13 @@ public void parseWithColonInPath() { } @Test - public void parseURLWithNull() { + public void parseUrlWithNull() { final UrlBuilder builder = UrlBuilder.parse((URL) null); assertEquals("", builder.toString()); } @Test - public void parseURLschemeAndHost() throws MalformedURLException { + public void parseUrlschemeAndHost() throws MalformedURLException { final UrlBuilder builder = UrlBuilder.parse(new URL("http://www.bing.com")); assertEquals("http://www.bing.com", builder.toString()); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java index baf565f95c41..265124303170 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java @@ -10,7 +10,7 @@ import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.BlockBlobItem; import com.azure.storage.blob.models.CpkInfo; @@ -193,20 +193,20 @@ public Mono upload(Flux data, ParallelTransferOptions * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.uploadWithResponse#Flux-ParallelTransferOptions-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.uploadWithResponse#Flux-ParallelTransferOptions-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions} * * @param data The data to write to the blob. Unlike other upload methods, this method does not require that the * {@code Flux} be replayable. In other words, it does not have to support multiple subscribers and is not expected * to produce the same values across subscriptions. * @param parallelTransferOptions {@link ParallelTransferOptions} used to configure buffered uploading. - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @param metadata Metadata to associate with the blob. * @param tier {@link AccessTier} for the destination blob. * @param accessConditions {@link BlobAccessConditions} * @return A reactive response containing the information of the uploaded block blob. */ public Mono> uploadWithResponse(Flux data, - ParallelTransferOptions parallelTransferOptions, BlobHTTPHeaders headers, Map metadata, + ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions) { // TODO: Parallelism parameter? Or let Reactor handle it? // TODO: Sample/api reference @@ -295,12 +295,12 @@ public Mono uploadFromFile(String filePath) { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.uploadFromFile#String-ParallelTransferOptions-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.uploadFromFile#String-ParallelTransferOptions-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions} * * @param filePath Path to the upload file * @param parallelTransferOptions {@link ParallelTransferOptions} to use to upload from file. Number of parallel * transfers parameter is ignored. - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @param metadata Metadata to associate with the blob. * @param tier {@link AccessTier} for the destination blob. * @param accessConditions {@link BlobAccessConditions} @@ -310,7 +310,7 @@ public Mono uploadFromFile(String filePath) { */ // TODO (gapra) : Investigate if this is can be parallelized, and include the parallelTransfers parameter. public Mono uploadFromFile(String filePath, ParallelTransferOptions parallelTransferOptions, - BlobHTTPHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions) { + BlobHttpHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions) { final ParallelTransferOptions finalParallelTransferOptions = parallelTransferOptions == null ? new ParallelTransferOptions() : parallelTransferOptions; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java index e9bf7b0eb152..3e461593a7b1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java @@ -7,7 +7,7 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.ParallelTransferOptions; import com.azure.storage.blob.specialized.AppendBlobClient; import com.azure.storage.blob.specialized.BlobClientBase; @@ -118,12 +118,12 @@ public void uploadFromFile(String filePath) throws IOException { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.BlobClient.uploadFromFile#String-ParallelTransferOptions-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.uploadFromFile#String-ParallelTransferOptions-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions-Duration} * * @param filePath Path of the file to upload * @param parallelTransferOptions {@link ParallelTransferOptions} to use to upload from file. Number of parallel * transfers parameter is ignored. - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @param metadata Metadata to associate with the blob. * @param tier {@link AccessTier} for the uploaded blob * @param accessConditions {@link BlobAccessConditions} @@ -131,7 +131,7 @@ public void uploadFromFile(String filePath) throws IOException { * @throws UncheckedIOException If an I/O error occurs */ public void uploadFromFile(String filePath, ParallelTransferOptions parallelTransferOptions, - BlobHTTPHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions, + BlobHttpHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions, Duration timeout) { Mono upload = this.client.uploadFromFile( filePath, parallelTransferOptions, headers, metadata, tier, accessConditions); 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 index fa7cd69963fb..6a4ce35dbe3c 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 @@ -21,7 +21,7 @@ /** * This class represents the components that make up an Azure Storage Container/Blob URL. You may parse an * existing URL into its parts with the {@link #parse(URL)} class. You may construct a URL from parts by calling {@link - * #toURL()}. + * #toUrl()}. */ public final class BlobUrlParts { private String scheme; @@ -188,7 +188,7 @@ public BlobUrlParts setUnparsedParameters(Map unparsedParamete * @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 { + public URL toUrl() throws MalformedURLException { UrlBuilder url = new UrlBuilder().setScheme(this.scheme).setHost(this.host); StringBuilder path = new StringBuilder(); @@ -217,7 +217,7 @@ public URL toURL() throws MalformedURLException { Utility.urlEncode(String.join(",", entry.getValue()))); } - return url.toURL(); + return url.toUrl(); } /** diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java index 1a2f394c8144..b5ffec2aa1ff 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java @@ -24,7 +24,7 @@ import com.azure.storage.blob.implementation.models.AppendBlobsAppendBlockResponse; import com.azure.storage.blob.implementation.models.AppendBlobsCreateResponse; import com.azure.storage.blob.models.AppendPositionAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.EncryptionAlgorithmType; import com.azure.storage.blob.models.LeaseAccessConditions; @@ -137,7 +137,7 @@ public Mono createWithRestResponseAsync(String contai * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, Integer timeout, Map metadata, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, Integer timeout, Map metadata, String requestId, BlobHttpHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String blobType = "AppendBlob"; String blobContentType = null; if (blobHTTPHeaders != null) { 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 5626195f0321..104d002c6c5a 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 @@ -23,11 +23,11 @@ import com.azure.core.implementation.RestProxy; import com.azure.core.implementation.util.Base64Util; import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.models.BlobsAbortCopyFromURLResponse; +import com.azure.storage.blob.implementation.models.BlobsAbortCopyFromUrlResponse; import com.azure.storage.blob.implementation.models.BlobsAcquireLeaseResponse; import com.azure.storage.blob.implementation.models.BlobsBreakLeaseResponse; import com.azure.storage.blob.implementation.models.BlobsChangeLeaseResponse; -import com.azure.storage.blob.implementation.models.BlobsCopyFromURLResponse; +import com.azure.storage.blob.implementation.models.BlobsCopyFromUrlResponse; import com.azure.storage.blob.implementation.models.BlobsCreateSnapshotResponse; import com.azure.storage.blob.implementation.models.BlobsDeleteResponse; import com.azure.storage.blob.implementation.models.BlobsDownloadResponse; @@ -38,14 +38,14 @@ import com.azure.storage.blob.implementation.models.BlobsRenameResponse; import com.azure.storage.blob.implementation.models.BlobsRenewLeaseResponse; import com.azure.storage.blob.implementation.models.BlobsSetAccessControlResponse; -import com.azure.storage.blob.implementation.models.BlobsSetHTTPHeadersResponse; +import com.azure.storage.blob.implementation.models.BlobsSetHttpHeadersResponse; import com.azure.storage.blob.implementation.models.BlobsSetMetadataResponse; import com.azure.storage.blob.implementation.models.BlobsSetTierResponse; -import com.azure.storage.blob.implementation.models.BlobsStartCopyFromURLResponse; +import com.azure.storage.blob.implementation.models.BlobsStartCopyFromUrlResponse; import com.azure.storage.blob.implementation.models.BlobsUndeleteResponse; import com.azure.storage.blob.implementation.models.DirectoryHttpHeaders; import com.azure.storage.blob.models.AccessTier; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; @@ -131,7 +131,7 @@ private interface BlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setHTTPHeaders(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); + Mono setHTTPHeaders(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({200}) @@ -171,17 +171,17 @@ private interface BlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono startCopyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTier tier, @HeaderParam("x-ms-rehydrate-priority") RehydratePriority rehydratePriority, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context); + Mono startCopyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTier tier, @HeaderParam("x-ms-rehydrate-priority") RehydratePriority rehydratePriority, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono copyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTier tier, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-requires-sync") String xMsRequiresSync, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context); + Mono copyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTier tier, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-requires-sync") String xMsRequiresSync, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-lease-id") String leaseId, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({204}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono abortCopyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("copyid") String copyId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-copy-action") String copyActionAbortConstant, @HeaderParam("x-ms-lease-id") String leaseId, Context context); + Mono abortCopyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("copyid") String copyId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-copy-action") String copyActionAbortConstant, @HeaderParam("x-ms-lease-id") String leaseId, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({200, 202}) @@ -715,7 +715,7 @@ public Mono undeleteWithRestResponseAsync(String containe * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setHTTPHeadersWithRestResponseAsync(String containerName, String blob, Context context) { + public Mono setHttpHeadersWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final String requestId = null; final String comp = "properties"; @@ -748,7 +748,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setHTTPHeadersWithRestResponseAsync(String containerName, String blob, Integer timeout, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono setHttpHeadersWithRestResponseAsync(String containerName, String blob, Integer timeout, String requestId, BlobHttpHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "properties"; String blobCacheControl = null; if (blobHTTPHeaders != null) { @@ -1282,7 +1282,7 @@ public Mono createSnapshotWithRestResponseAsync(Str * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { + public Mono startCopyFromUrlWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { final Integer timeout = null; final Map metadata = null; final AccessTier tier = null; @@ -1319,7 +1319,7 @@ public Mono startCopyFromURLWithRestResponseAsync * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, AccessTier tier, RehydratePriority rehydratePriority, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono startCopyFromUrlWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, AccessTier tier, RehydratePriority rehydratePriority, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { OffsetDateTime sourceIfModifiedSince = null; if (sourceModifiedAccessConditions != null) { sourceIfModifiedSince = sourceModifiedAccessConditions.getSourceIfModifiedSince(); @@ -1374,7 +1374,7 @@ public Mono startCopyFromURLWithRestResponseAsync * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { + public Mono copyFromUrlWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { final Integer timeout = null; final Map metadata = null; final AccessTier tier = null; @@ -1410,7 +1410,7 @@ public Mono copyFromURLWithRestResponseAsync(String co * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, AccessTier tier, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono copyFromUrlWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, AccessTier tier, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { final String xMsRequiresSync = "true"; OffsetDateTime sourceIfModifiedSince = null; if (sourceModifiedAccessConditions != null) { @@ -1466,7 +1466,7 @@ public Mono copyFromURLWithRestResponseAsync(String co * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono abortCopyFromURLWithRestResponseAsync(String containerName, String blob, String copyId, Context context) { + public Mono abortCopyFromUrlWithRestResponseAsync(String containerName, String blob, String copyId, Context context) { final Integer timeout = null; final String requestId = null; final String comp = "copy"; @@ -1489,7 +1489,7 @@ public Mono abortCopyFromURLWithRestResponseAsync * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono abortCopyFromURLWithRestResponseAsync(String containerName, String blob, String copyId, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono abortCopyFromUrlWithRestResponseAsync(String containerName, String blob, String copyId, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { final String comp = "copy"; final String copyActionAbortConstant = "abort"; String leaseId = null; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java index 53bb60004711..be7293c3edeb 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java @@ -23,11 +23,11 @@ import com.azure.core.util.Context; import com.azure.storage.blob.implementation.models.BlockBlobsCommitBlockListResponse; import com.azure.storage.blob.implementation.models.BlockBlobsGetBlockListResponse; -import com.azure.storage.blob.implementation.models.BlockBlobsStageBlockFromURLResponse; +import com.azure.storage.blob.implementation.models.BlockBlobsStageBlockFromUrlResponse; import com.azure.storage.blob.implementation.models.BlockBlobsStageBlockResponse; import com.azure.storage.blob.implementation.models.BlockBlobsUploadResponse; import com.azure.storage.blob.models.AccessTier; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlockListType; import com.azure.storage.blob.models.BlockLookupList; import com.azure.storage.blob.models.CpkInfo; @@ -88,7 +88,7 @@ private interface BlockBlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono stageBlockFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("blockid") String blockId, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context); + Mono stageBlockFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("blockid") String blockId, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({201}) @@ -156,7 +156,7 @@ public Mono uploadWithRestResponseAsync(String contain * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Integer timeout, Map metadata, AccessTier tier, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono uploadWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Integer timeout, Map metadata, AccessTier tier, String requestId, BlobHttpHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String blobType = "BlockBlob"; String blobContentType = null; if (blobHTTPHeaders != null) { @@ -301,7 +301,7 @@ public Mono stageBlockWithRestResponseAsync(String * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono stageBlockFromURLWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, URL sourceUrl, Context context) { + public Mono stageBlockFromUrlWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, URL sourceUrl, Context context) { final String sourceRange = null; final Integer timeout = null; final String requestId = null; @@ -340,7 +340,7 @@ public Mono stageBlockFromURLWithRestRespon * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono stageBlockFromURLWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, URL sourceUrl, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String requestId, CpkInfo cpkInfo, LeaseAccessConditions leaseAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { + public Mono stageBlockFromUrlWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, URL sourceUrl, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String requestId, CpkInfo cpkInfo, LeaseAccessConditions leaseAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { final String comp = "block"; String encryptionKey = null; if (cpkInfo != null) { @@ -438,7 +438,7 @@ public Mono commitBlockListWithRestResponseAs * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono commitBlockListWithRestResponseAsync(String containerName, String blob, BlockLookupList blocks, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, AccessTier tier, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono commitBlockListWithRestResponseAsync(String containerName, String blob, BlockLookupList blocks, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, AccessTier tier, String requestId, BlobHttpHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "blocklist"; String blobCacheControl = null; if (blobHTTPHeaders != null) { diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java index 3f2956c1afb3..19b8c45a2bd3 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java @@ -28,10 +28,10 @@ import com.azure.storage.blob.implementation.models.PageBlobsGetPageRangesResponse; import com.azure.storage.blob.implementation.models.PageBlobsResizeResponse; import com.azure.storage.blob.implementation.models.PageBlobsUpdateSequenceNumberResponse; -import com.azure.storage.blob.implementation.models.PageBlobsUploadPagesFromURLResponse; +import com.azure.storage.blob.implementation.models.PageBlobsUploadPagesFromUrlResponse; import com.azure.storage.blob.implementation.models.PageBlobsUploadPagesResponse; import com.azure.storage.blob.implementation.models.PremiumPageBlobAccessTier; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.EncryptionAlgorithmType; import com.azure.storage.blob.models.LeaseAccessConditions; @@ -97,7 +97,7 @@ private interface PageBlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono uploadPagesFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @HeaderParam("Content-Length") long contentLength, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context); + Mono uploadPagesFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @HeaderParam("x-ms-copy-source") URL copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-source-content-md5") String sourceContentMD5, @HeaderParam("x-ms-source-content-crc64") String sourceContentcrc64, @HeaderParam("Content-Length") long contentLength, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-source-if-modified-since") DateTimeRfc1123 sourceIfModifiedSince, @HeaderParam("x-ms-source-if-unmodified-since") DateTimeRfc1123 sourceIfUnmodifiedSince, @HeaderParam("x-ms-source-if-match") String sourceIfMatch, @HeaderParam("x-ms-source-if-none-match") String sourceIfNoneMatch, Context context); @Get("{containerName}/{blob}") @ExpectedResponses({200}) @@ -182,7 +182,7 @@ public Mono createWithRestResponseAsync(String containe * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, long blobContentLength, Integer timeout, PremiumPageBlobAccessTier tier, Map metadata, Long blobSequenceNumber, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, long blobContentLength, Integer timeout, PremiumPageBlobAccessTier tier, Map metadata, Long blobSequenceNumber, String requestId, BlobHttpHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String blobType = "PageBlob"; String blobContentType = null; if (blobHTTPHeaders != null) { @@ -470,7 +470,7 @@ public Mono clearPagesWithRestResponseAsync(String * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadPagesFromURLWithRestResponseAsync(String containerName, String blob, URL sourceUrl, String sourceRange, long contentLength, String range, Context context) { + public Mono uploadPagesFromUrlWithRestResponseAsync(String containerName, String blob, URL sourceUrl, String sourceRange, long contentLength, String range, Context context) { final Integer timeout = null; final String requestId = null; final String comp = "page"; @@ -518,7 +518,7 @@ public Mono uploadPagesFromURLWithRestRespo * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadPagesFromURLWithRestResponseAsync(String containerName, String blob, URL sourceUrl, String sourceRange, long contentLength, String range, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String requestId, CpkInfo cpkInfo, LeaseAccessConditions leaseAccessConditions, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { + public Mono uploadPagesFromUrlWithRestResponseAsync(String containerName, String blob, URL sourceUrl, String sourceRange, long contentLength, String range, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, String requestId, CpkInfo cpkInfo, LeaseAccessConditions leaseAccessConditions, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { final String comp = "page"; final String pageWrite = "update"; String encryptionKey = null; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobAbortCopyFromURLHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobAbortCopyFromURLHeaders.java index 440302e288f8..3501306b2a64 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobAbortCopyFromURLHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobAbortCopyFromURLHeaders.java @@ -15,7 +15,7 @@ */ @JacksonXmlRootElement(localName = "Blob-AbortCopyFromURL-Headers") @Fluent -public final class BlobAbortCopyFromURLHeaders { +public final class BlobAbortCopyFromUrlHeaders { /* * If a client request id header is sent in the request, this header will * be present in the response with the same value. @@ -70,7 +70,7 @@ public String getClientRequestId() { * @param clientRequestId the clientRequestId value to set. * @return the BlobAbortCopyFromURLHeaders object itself. */ - public BlobAbortCopyFromURLHeaders setClientRequestId(String clientRequestId) { + public BlobAbortCopyFromUrlHeaders setClientRequestId(String clientRequestId) { this.clientRequestId = clientRequestId; return this; } @@ -92,7 +92,7 @@ public String getRequestId() { * @param requestId the requestId value to set. * @return the BlobAbortCopyFromURLHeaders object itself. */ - public BlobAbortCopyFromURLHeaders setRequestId(String requestId) { + public BlobAbortCopyFromUrlHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -116,7 +116,7 @@ public String getVersion() { * @param version the version value to set. * @return the BlobAbortCopyFromURLHeaders object itself. */ - public BlobAbortCopyFromURLHeaders setVersion(String version) { + public BlobAbortCopyFromUrlHeaders setVersion(String version) { this.version = version; return this; } @@ -141,7 +141,7 @@ public OffsetDateTime getDateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobAbortCopyFromURLHeaders object itself. */ - public BlobAbortCopyFromURLHeaders setDateProperty(OffsetDateTime dateProperty) { + public BlobAbortCopyFromUrlHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -165,7 +165,7 @@ public String getErrorCode() { * @param errorCode the errorCode value to set. * @return the BlobAbortCopyFromURLHeaders object itself. */ - public BlobAbortCopyFromURLHeaders setErrorCode(String errorCode) { + public BlobAbortCopyFromUrlHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobCopyFromURLHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobCopyFromURLHeaders.java index 05f109de86ce..3b1a8417acf1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobCopyFromURLHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobCopyFromURLHeaders.java @@ -16,7 +16,7 @@ */ @JacksonXmlRootElement(localName = "Blob-CopyFromURL-Headers") @Fluent -public final class BlobCopyFromURLHeaders { +public final class BlobCopyFromUrlHeaders { /* * The ETag contains a value that you can use to perform operations * conditionally. If the request version is 2011-08-18 or newer, the ETag @@ -108,7 +108,7 @@ public String getETag() { * @param eTag the eTag value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders setETag(String eTag) { + public BlobCopyFromUrlHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -137,7 +137,7 @@ public OffsetDateTime getLastModified() { * @param lastModified the lastModified value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders setLastModified(OffsetDateTime lastModified) { + public BlobCopyFromUrlHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -165,7 +165,7 @@ public String getClientRequestId() { * @param clientRequestId the clientRequestId value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders setClientRequestId(String clientRequestId) { + public BlobCopyFromUrlHeaders setClientRequestId(String clientRequestId) { this.clientRequestId = clientRequestId; return this; } @@ -187,7 +187,7 @@ public String getRequestId() { * @param requestId the requestId value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders setRequestId(String requestId) { + public BlobCopyFromUrlHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -211,7 +211,7 @@ public String getVersion() { * @param version the version value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders setVersion(String version) { + public BlobCopyFromUrlHeaders setVersion(String version) { this.version = version; return this; } @@ -236,7 +236,7 @@ public OffsetDateTime getDateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders setDateProperty(OffsetDateTime dateProperty) { + public BlobCopyFromUrlHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -260,7 +260,7 @@ public String getCopyId() { * @param copyId the copyId value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders setCopyId(String copyId) { + public BlobCopyFromUrlHeaders setCopyId(String copyId) { this.copyId = copyId; return this; } @@ -282,7 +282,7 @@ public SyncCopyStatusType getCopyStatus() { * @param copyStatus the copyStatus value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders setCopyStatus(SyncCopyStatusType copyStatus) { + public BlobCopyFromUrlHeaders setCopyStatus(SyncCopyStatusType copyStatus) { this.copyStatus = copyStatus; return this; } @@ -306,7 +306,7 @@ public String getVersionId() { * @param versionId the versionId value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders setVersionId(String versionId) { + public BlobCopyFromUrlHeaders setVersionId(String versionId) { this.versionId = versionId; return this; } @@ -326,7 +326,7 @@ public String getErrorCode() { * @param errorCode the errorCode value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders setErrorCode(String errorCode) { + public BlobCopyFromUrlHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobSetHTTPHeadersHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobSetHTTPHeadersHeaders.java index 2006174b0b88..33709160f8b8 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobSetHTTPHeadersHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobSetHTTPHeadersHeaders.java @@ -15,7 +15,7 @@ */ @JacksonXmlRootElement(localName = "Blob-SetHTTPHeaders-Headers") @Fluent -public final class BlobSetHTTPHeadersHeaders { +public final class BlobSetHttpHeadersHeaders { /* * The ETag contains a value that you can use to perform operations * conditionally. If the request version is 2011-08-18 or newer, the ETag @@ -93,7 +93,7 @@ public String getETag() { * @param eTag the eTag value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders setETag(String eTag) { + public BlobSetHttpHeadersHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -122,7 +122,7 @@ public OffsetDateTime getLastModified() { * @param lastModified the lastModified value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders setLastModified(OffsetDateTime lastModified) { + public BlobSetHttpHeadersHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -148,7 +148,7 @@ public Long getBlobSequenceNumber() { * @param blobSequenceNumber the blobSequenceNumber value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders setBlobSequenceNumber(Long blobSequenceNumber) { + public BlobSetHttpHeadersHeaders setBlobSequenceNumber(Long blobSequenceNumber) { this.blobSequenceNumber = blobSequenceNumber; return this; } @@ -172,7 +172,7 @@ public String getClientRequestId() { * @param clientRequestId the clientRequestId value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders setClientRequestId(String clientRequestId) { + public BlobSetHttpHeadersHeaders setClientRequestId(String clientRequestId) { this.clientRequestId = clientRequestId; return this; } @@ -194,7 +194,7 @@ public String getRequestId() { * @param requestId the requestId value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders setRequestId(String requestId) { + public BlobSetHttpHeadersHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -218,7 +218,7 @@ public String getVersion() { * @param version the version value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders setVersion(String version) { + public BlobSetHttpHeadersHeaders setVersion(String version) { this.version = version; return this; } @@ -243,7 +243,7 @@ public OffsetDateTime getDateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders setDateProperty(OffsetDateTime dateProperty) { + public BlobSetHttpHeadersHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -267,7 +267,7 @@ public String getErrorCode() { * @param errorCode the errorCode value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders setErrorCode(String errorCode) { + public BlobSetHttpHeadersHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobStartCopyFromURLHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobStartCopyFromURLHeaders.java index 739fb5389456..c84af6ce5146 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobStartCopyFromURLHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobStartCopyFromURLHeaders.java @@ -16,7 +16,7 @@ */ @JacksonXmlRootElement(localName = "Blob-StartCopyFromURL-Headers") @Fluent -public final class BlobStartCopyFromURLHeaders { +public final class BlobStartCopyFromUrlHeaders { /* * The ETag contains a value that you can use to perform operations * conditionally. If the request version is 2011-08-18 or newer, the ETag @@ -110,7 +110,7 @@ public String getETag() { * @param eTag the eTag value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders setETag(String eTag) { + public BlobStartCopyFromUrlHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -139,7 +139,7 @@ public OffsetDateTime getLastModified() { * @param lastModified the lastModified value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders setLastModified(OffsetDateTime lastModified) { + public BlobStartCopyFromUrlHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -167,7 +167,7 @@ public String getClientRequestId() { * @param clientRequestId the clientRequestId value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders setClientRequestId(String clientRequestId) { + public BlobStartCopyFromUrlHeaders setClientRequestId(String clientRequestId) { this.clientRequestId = clientRequestId; return this; } @@ -189,7 +189,7 @@ public String getRequestId() { * @param requestId the requestId value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders setRequestId(String requestId) { + public BlobStartCopyFromUrlHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -213,7 +213,7 @@ public String getVersion() { * @param version the version value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders setVersion(String version) { + public BlobStartCopyFromUrlHeaders setVersion(String version) { this.version = version; return this; } @@ -238,7 +238,7 @@ public OffsetDateTime getDateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders setDateProperty(OffsetDateTime dateProperty) { + public BlobStartCopyFromUrlHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -266,7 +266,7 @@ public String getCopyId() { * @param copyId the copyId value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders setCopyId(String copyId) { + public BlobStartCopyFromUrlHeaders setCopyId(String copyId) { this.copyId = copyId; return this; } @@ -290,7 +290,7 @@ public CopyStatusType getCopyStatus() { * @param copyStatus the copyStatus value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders setCopyStatus(CopyStatusType copyStatus) { + public BlobStartCopyFromUrlHeaders setCopyStatus(CopyStatusType copyStatus) { this.copyStatus = copyStatus; return this; } @@ -314,7 +314,7 @@ public String getVersionId() { * @param versionId the versionId value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders setVersionId(String versionId) { + public BlobStartCopyFromUrlHeaders setVersionId(String versionId) { this.versionId = versionId; return this; } @@ -334,7 +334,7 @@ public String getErrorCode() { * @param errorCode the errorCode value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders setErrorCode(String errorCode) { + public BlobStartCopyFromUrlHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobsAbortCopyFromURLResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobsAbortCopyFromURLResponse.java index 1b16512eb53b..c268a98ae087 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobsAbortCopyFromURLResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobsAbortCopyFromURLResponse.java @@ -11,7 +11,7 @@ /** * Contains all response data for the abortCopyFromURL operation. */ -public final class BlobsAbortCopyFromURLResponse extends ResponseBase { +public final class BlobsAbortCopyFromUrlResponse extends ResponseBase { /** * Creates an instance of BlobsAbortCopyFromURLResponse. * @@ -21,7 +21,7 @@ public final class BlobsAbortCopyFromURLResponse extends ResponseBase { +public final class BlobsCopyFromUrlResponse extends ResponseBase { /** * Creates an instance of BlobsCopyFromURLResponse. * @@ -21,7 +21,7 @@ public final class BlobsCopyFromURLResponse extends ResponseBase { +public final class BlobsSetHttpHeadersResponse extends ResponseBase { /** * Creates an instance of BlobsSetHTTPHeadersResponse. * @@ -21,7 +21,7 @@ public final class BlobsSetHTTPHeadersResponse extends ResponseBase { +public final class BlobsStartCopyFromUrlResponse extends ResponseBase { /** * Creates an instance of BlobsStartCopyFromURLResponse. * @@ -21,7 +21,7 @@ public final class BlobsStartCopyFromURLResponse extends ResponseBase { +public final class BlockBlobsStageBlockFromUrlResponse extends ResponseBase { /** * Creates an instance of BlockBlobsStageBlockFromURLResponse. * @@ -21,7 +21,7 @@ public final class BlockBlobsStageBlockFromURLResponse extends ResponseBase { +public final class PageBlobsUploadPagesFromUrlResponse extends ResponseBase { /** * Creates an instance of PageBlobsUploadPagesFromURLResponse. * @@ -21,7 +21,7 @@ public final class PageBlobsUploadPagesFromURLResponse extends ResponseBase create() { * * {@codesnippet com.azure.storage.blob.specialized.AppendBlobAsyncClient.createWithResponse#BlobHTTPHeaders-Map-BlobAccessConditions} * - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @param metadata Metadata to associate with the blob. * @param accessConditions {@link BlobAccessConditions} * @return A {@link Mono} containing {@link Response} whose {@link Response#getValue() value} contains the created * appended blob. */ - public Mono> createWithResponse(BlobHTTPHeaders headers, Map metadata, - BlobAccessConditions accessConditions) { + public Mono> createWithResponse(BlobHttpHeaders headers, Map metadata, + BlobAccessConditions accessConditions) { return withContext(context -> createWithResponse(headers, metadata, accessConditions, context)); } - Mono> createWithResponse(BlobHTTPHeaders headers, Map metadata, - BlobAccessConditions accessConditions, Context context) { + Mono> createWithResponse(BlobHttpHeaders headers, Map metadata, + BlobAccessConditions accessConditions, Context context) { accessConditions = (accessConditions == null) ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.appendBlobs().createWithRestResponseAsync(null, diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/AppendBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/AppendBlobClient.java index fd6643e8b565..8ef0bf4c4aeb 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/AppendBlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/AppendBlobClient.java @@ -14,7 +14,7 @@ import com.azure.storage.blob.models.AppendBlobAccessConditions; import com.azure.storage.blob.models.AppendBlobItem; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.blob.models.StorageException; @@ -109,16 +109,16 @@ public AppendBlobItem create() { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.AppendBlobClient.createWithResponse#BlobHTTPHeaders-Map-BlobAccessConditions-Duration-Context} + * {@codesnippet com.azure.storage.blob.specialized.AppendBlobClient.createWithResponse#BlobHttpHeaders-Map-BlobAccessConditions-Duration-Context} * - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @param metadata Metadata to associate with the blob. * @param accessConditions {@link BlobAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link Response} whose {@link Response#getValue() value} contains the created appended blob. */ - public Response createWithResponse(BlobHTTPHeaders headers, Map metadata, + public Response createWithResponse(BlobHttpHeaders headers, Map metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) { return Utility.blockWithOptionalTimeout(appendBlobAsyncClient. createWithResponse(headers, metadata, accessConditions, context), timeout); 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 1f366064fbb0..850dff70eea8 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 @@ -20,7 +20,7 @@ import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; @@ -215,16 +215,16 @@ Mono> existsWithResponse(Context context) { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.startCopyFromURL#URL} + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.startCopyFromUrl#URL} * *

    For more information, see the * Azure Docs

    * - * @param sourceURL The source URL to copy from. URLs outside of Azure may only be copied to block blobs. + * @param sourceUrl The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @return A reactive response containing the copy ID for the long running operation. */ - public Mono startCopyFromURL(URL sourceURL) { - return startCopyFromURLWithResponse(sourceURL, null, null, null, null, null).flatMap(FluxUtil::toMono); + public Mono startCopyFromUrl(URL sourceUrl) { + return startCopyFromUrlWithResponse(sourceUrl, null, null, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -232,7 +232,7 @@ public Mono startCopyFromURL(URL sourceURL) { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.startCopyFromURLWithResponse#URL-Map-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.startCopyFromUrlWithResponse#URL-Map-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions} * *

    For more information, see the * Azure Docs

    @@ -248,14 +248,14 @@ public Mono startCopyFromURL(URL sourceURL) { * @param destAccessConditions {@link BlobAccessConditions} against the destination. * @return A reactive response containing the copy ID for the long running operation. */ - public Mono> startCopyFromURLWithResponse(URL sourceURL, Map metadata, + public Mono> startCopyFromUrlWithResponse(URL sourceURL, Map metadata, AccessTier tier, RehydratePriority priority, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions) { - return withContext(context -> startCopyFromURLWithResponse(sourceURL, metadata, tier, priority, + return withContext(context -> startCopyFromUrlWithResponse(sourceURL, metadata, tier, priority, sourceModifiedAccessConditions, destAccessConditions, context)); } - Mono> startCopyFromURLWithResponse(URL sourceURL, Map metadata, AccessTier tier, + Mono> startCopyFromUrlWithResponse(URL sourceURL, Map metadata, AccessTier tier, RehydratePriority priority, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, Context context) { sourceModifiedAccessConditions = sourceModifiedAccessConditions == null @@ -269,7 +269,7 @@ Mono> startCopyFromURLWithResponse(URL sourceURL, Map> startCopyFromURLWithResponse(URL sourceURL, MapCode Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.abortCopyFromURL#String} + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.abortCopyFromUrl#String} * *

    For more information, see the * Azure Docs

    @@ -289,8 +289,8 @@ Mono> startCopyFromURLWithResponse(URL sourceURL, Map abortCopyFromURL(String copyId) { - return abortCopyFromURLWithResponse(copyId, null).flatMap(FluxUtil::toMono); + public Mono abortCopyFromUrl(String copyId) { + return abortCopyFromUrlWithResponse(copyId, null).flatMap(FluxUtil::toMono); } /** @@ -298,7 +298,7 @@ public Mono abortCopyFromURL(String copyId) { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.abortCopyFromURLWithResponse#String-LeaseAccessConditions} + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.abortCopyFromUrlWithResponse#String-LeaseAccessConditions} * *

    For more information, see the * Azure Docs

    @@ -308,14 +308,14 @@ public Mono abortCopyFromURL(String copyId) { * not match the active lease on the blob. * @return A reactive response signalling completion. */ - public Mono> abortCopyFromURLWithResponse(String copyId, - LeaseAccessConditions leaseAccessConditions) { - return withContext(context -> abortCopyFromURLWithResponse(copyId, leaseAccessConditions, context)); + public Mono> abortCopyFromUrlWithResponse(String copyId, + LeaseAccessConditions leaseAccessConditions) { + return withContext(context -> abortCopyFromUrlWithResponse(copyId, leaseAccessConditions, context)); } - Mono> abortCopyFromURLWithResponse(String copyId, LeaseAccessConditions leaseAccessConditions, - Context context) { - return postProcessResponse(this.azureBlobStorage.blobs().abortCopyFromURLWithRestResponseAsync( + Mono> abortCopyFromUrlWithResponse(String copyId, LeaseAccessConditions leaseAccessConditions, + Context context) { + return postProcessResponse(this.azureBlobStorage.blobs().abortCopyFromUrlWithRestResponseAsync( null, null, copyId, null, null, leaseAccessConditions, context)) .map(response -> new SimpleResponse<>(response, null)); } @@ -325,7 +325,7 @@ Mono> abortCopyFromURLWithResponse(String copyId, LeaseAccessCond * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.copyFromURL#URL} + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.copyFromUrl#URL} * *

    For more information, see the * Azure Docs

    @@ -333,8 +333,8 @@ Mono> abortCopyFromURLWithResponse(String copyId, LeaseAccessCond * @param copySource The source URL to copy from. * @return A reactive response containing the copy ID for the long running operation. */ - public Mono copyFromURL(URL copySource) { - return copyFromURLWithResponse(copySource, null, null, null, null).flatMap(FluxUtil::toMono); + public Mono copyFromUrl(URL copySource) { + return copyFromUrlWithResponse(copySource, null, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -342,7 +342,7 @@ public Mono copyFromURL(URL copySource) { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.copyFromURLWithResponse#URL-Map-AccessTier-ModifiedAccessConditions-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.copyFromUrlWithResponse#URL-Map-AccessTier-ModifiedAccessConditions-BlobAccessConditions} * *

    For more information, see the * Azure Docs

    @@ -357,13 +357,13 @@ public Mono copyFromURL(URL copySource) { * @param destAccessConditions {@link BlobAccessConditions} against the destination. * @return A reactive response containing the copy ID for the long running operation. */ - public Mono> copyFromURLWithResponse(URL copySource, Map metadata, AccessTier tier, + public Mono> copyFromUrlWithResponse(URL copySource, Map metadata, AccessTier tier, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions) { - return withContext(context -> copyFromURLWithResponse(copySource, metadata, tier, + return withContext(context -> copyFromUrlWithResponse(copySource, metadata, tier, sourceModifiedAccessConditions, destAccessConditions, context)); } - Mono> copyFromURLWithResponse(URL copySource, Map metadata, AccessTier tier, + Mono> copyFromUrlWithResponse(URL copySource, Map metadata, AccessTier tier, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, Context context) { sourceModifiedAccessConditions = sourceModifiedAccessConditions == null @@ -377,7 +377,7 @@ Mono> copyFromURLWithResponse(URL copySource, Map> getPropertiesWithResponse(BlobAccessConditions ac * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.setHTTPHeaders#BlobHTTPHeaders} + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.setHttpHeaders#BlobHttpHeaders} * *

    For more information, see the * Azure Docs

    * - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @return A reactive response signalling completion. */ - public Mono setHTTPHeaders(BlobHTTPHeaders headers) { - return setHTTPHeadersWithResponse(headers, null).flatMap(FluxUtil::toMono); + public Mono setHttpHeaders(BlobHttpHeaders headers) { + return setHttpHeadersWithResponse(headers, null).flatMap(FluxUtil::toMono); } /** @@ -718,25 +718,25 @@ public Mono setHTTPHeaders(BlobHTTPHeaders headers) { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.specialized.BlobAsyncClientBase.setHttpHeadersWithResponse#BlobHttpHeaders-BlobAccessConditions} * *

    For more information, see the * Azure Docs

    * - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @param accessConditions {@link BlobAccessConditions} * @return A reactive response signalling completion. */ - public Mono> setHTTPHeadersWithResponse(BlobHTTPHeaders headers, - BlobAccessConditions accessConditions) { - return withContext(context -> setHTTPHeadersWithResponse(headers, accessConditions, context)); + public Mono> setHttpHeadersWithResponse(BlobHttpHeaders headers, + BlobAccessConditions accessConditions) { + return withContext(context -> setHttpHeadersWithResponse(headers, accessConditions, context)); } - Mono> setHTTPHeadersWithResponse(BlobHTTPHeaders headers, BlobAccessConditions accessConditions, - Context context) { + Mono> setHttpHeadersWithResponse(BlobHttpHeaders headers, BlobAccessConditions accessConditions, + Context context) { accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - return postProcessResponse(this.azureBlobStorage.blobs().setHTTPHeadersWithRestResponseAsync( + return postProcessResponse(this.azureBlobStorage.blobs().setHttpHeadersWithRestResponseAsync( null, null, null, null, headers, accessConditions.getLeaseAccessConditions(), accessConditions.getModifiedAccessConditions(), context)) .map(response -> new SimpleResponse<>(response, null)); 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 4fb21899d661..b94fa37d0df6 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 @@ -13,7 +13,7 @@ import com.azure.storage.blob.BlobProperties; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; @@ -196,7 +196,7 @@ public Response existsWithResponse(Duration timeout, Context context) { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.startCopyFromURL#URL} + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.startCopyFromUrl#URL} * *

    For more information, see the * Azure Docs

    @@ -204,8 +204,8 @@ public Response existsWithResponse(Duration timeout, Context context) { * @param sourceURL The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @return The copy ID for the long running operation. */ - public String startCopyFromURL(URL sourceURL) { - return startCopyFromURLWithResponse(sourceURL, null, null, null, null, null, null, Context.NONE).getValue(); + public String startCopyFromUrl(URL sourceURL) { + return startCopyFromUrlWithResponse(sourceURL, null, null, null, null, null, null, Context.NONE).getValue(); } /** @@ -213,12 +213,12 @@ public String startCopyFromURL(URL sourceURL) { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.startCopyFromURLWithResponse#URL-Map-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions-Duration-Context} + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.startCopyFromUrlWithResponse#URL-Map-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions-Duration-Context} * *

    For more information, see the * Azure Docs

    * - * @param sourceURL The source URL to copy from. URLs outside of Azure may only be copied to block blobs. + * @param sourceUrl The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @param metadata Metadata to associate with the destination blob. * @param tier {@link AccessTier} for the destination blob. * @param priority {@link RehydratePriority} for rehydrating the blob. @@ -231,11 +231,11 @@ public String startCopyFromURL(URL sourceURL) { * @param context Additional context that is passed through the Http pipeline during the service call. * @return The copy ID for the long running operation. */ - public Response startCopyFromURLWithResponse(URL sourceURL, Map metadata, AccessTier tier, + public Response startCopyFromUrlWithResponse(URL sourceUrl, Map metadata, AccessTier tier, RehydratePriority priority, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, Duration timeout, Context context) { Mono> response = client - .startCopyFromURLWithResponse(sourceURL, metadata, tier, priority, sourceModifiedAccessConditions, + .startCopyFromUrlWithResponse(sourceUrl, metadata, tier, priority, sourceModifiedAccessConditions, destAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); @@ -246,15 +246,15 @@ public Response startCopyFromURLWithResponse(URL sourceURL, MapCode Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.abortCopyFromURL#String} + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.abortCopyFromUrl#String} * *

    For more information, see the * Azure Docs

    * * @param copyId The id of the copy operation to abort. */ - public void abortCopyFromURL(String copyId) { - abortCopyFromURLWithResponse(copyId, null, null, Context.NONE); + public void abortCopyFromUrl(String copyId) { + abortCopyFromUrlWithResponse(copyId, null, null, Context.NONE); } /** @@ -262,7 +262,7 @@ public void abortCopyFromURL(String copyId) { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.abortCopyFromURLWithResponse#String-LeaseAccessConditions-Duration-Context} + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.abortCopyFromUrlWithResponse#String-LeaseAccessConditions-Duration-Context} * *

    For more information, see the * Azure Docs

    @@ -274,9 +274,9 @@ public void abortCopyFromURL(String copyId) { * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing status code and HTTP headers. */ - public Response abortCopyFromURLWithResponse(String copyId, LeaseAccessConditions leaseAccessConditions, - Duration timeout, Context context) { - Mono> response = client.abortCopyFromURLWithResponse(copyId, leaseAccessConditions, + public Response abortCopyFromUrlWithResponse(String copyId, LeaseAccessConditions leaseAccessConditions, + Duration timeout, Context context) { + Mono> response = client.abortCopyFromUrlWithResponse(copyId, leaseAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); @@ -287,7 +287,7 @@ public Response abortCopyFromURLWithResponse(String copyId, LeaseAccessCon * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.copyFromURL#URL} + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.copyFromUrl#URL} * *

    For more information, see the * Azure Docs

    @@ -295,8 +295,8 @@ public Response abortCopyFromURLWithResponse(String copyId, LeaseAccessCon * @param copySource The source URL to copy from. * @return The copy ID for the long running operation. */ - public String copyFromURL(URL copySource) { - return copyFromURLWithResponse(copySource, null, null, null, null, null, Context.NONE).getValue(); + public String copyFromUrl(URL copySource) { + return copyFromUrlWithResponse(copySource, null, null, null, null, null, Context.NONE).getValue(); } /** @@ -304,7 +304,7 @@ public String copyFromURL(URL copySource) { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.copyFromURLWithResponse#URL-Map-AccessTier-ModifiedAccessConditions-BlobAccessConditions-Duration-Context} + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.copyFromUrlWithResponse#URL-Map-AccessTier-ModifiedAccessConditions-BlobAccessConditions-Duration-Context} * *

    For more information, see the * Azure Docs

    @@ -321,11 +321,11 @@ public String copyFromURL(URL copySource) { * @param context Additional context that is passed through the Http pipeline during the service call. * @return The copy ID for the long running operation. */ - public Response copyFromURLWithResponse(URL copySource, Map metadata, AccessTier tier, + public Response copyFromUrlWithResponse(URL copySource, Map metadata, AccessTier tier, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, Duration timeout, Context context) { Mono> response = client - .copyFromURLWithResponse(copySource, metadata, tier, sourceModifiedAccessConditions, destAccessConditions, + .copyFromUrlWithResponse(copySource, metadata, tier, sourceModifiedAccessConditions, destAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); @@ -539,15 +539,15 @@ public Response getPropertiesWithResponse(BlobAccessConditions a * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.setHTTPHeaders#BlobHTTPHeaders} + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.setHttpHeaders#BlobHttpHeaders} * *

    For more information, see the * Azure Docs

    * - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} */ - public void setHTTPHeaders(BlobHTTPHeaders headers) { - setHTTPHeadersWithResponse(headers, null, null, Context.NONE); + public void setHttpHeaders(BlobHttpHeaders headers) { + setHttpHeadersWithResponse(headers, null, null, Context.NONE); } /** @@ -556,21 +556,21 @@ public void setHTTPHeaders(BlobHTTPHeaders headers) { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context} + * {@codesnippet com.azure.storage.blob.specialized.BlobClientBase.setHttpHeadersWithResponse#BlobHttpHeaders-BlobAccessConditions-Duration-Context} * *

    For more information, see the * Azure Docs

    * - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @param accessConditions {@link BlobAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing status code and HTTP headers. */ - public Response setHTTPHeadersWithResponse(BlobHTTPHeaders headers, BlobAccessConditions accessConditions, - Duration timeout, Context context) { + public Response setHttpHeadersWithResponse(BlobHttpHeaders headers, BlobAccessConditions accessConditions, + Duration timeout, Context context) { Mono> response = client - .setHTTPHeadersWithResponse(headers, accessConditions, context); + .setHttpHeadersWithResponse(headers, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobAsyncClient.java index 551f807bdd28..5482b3531676 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobAsyncClient.java @@ -12,7 +12,7 @@ import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.BlockBlobItem; import com.azure.storage.blob.models.BlockList; @@ -119,19 +119,19 @@ public Mono upload(Flux data, long length) { * (the default). In other words, the Flux must produce the same data each time it is subscribed to. * @param length The exact length of the data. It is important that this value match precisely the length of the * data emitted by the {@code Flux}. - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @param metadata Metadata to associate with the blob. * @param tier {@link AccessTier} for the destination blob. * @param accessConditions {@link BlobAccessConditions} * @return A reactive response containing the information of the uploaded block blob. */ - public Mono> uploadWithResponse(Flux data, long length, BlobHTTPHeaders headers, + public Mono> uploadWithResponse(Flux data, long length, BlobHttpHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions) { return withContext(context -> uploadWithResponse(data, length, headers, metadata, tier, accessConditions, context)); } - Mono> uploadWithResponse(Flux data, long length, BlobHTTPHeaders headers, + Mono> uploadWithResponse(Flux data, long length, BlobHttpHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; @@ -208,7 +208,7 @@ base64BlockID, length, data, null, null, null, null, leaseAccessConditions, getC * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlockBlobAsyncClient.stageBlockFromURL#String-URL-BlobRange} + * {@codesnippet com.azure.storage.blob.specialized.BlockBlobAsyncClient.stageBlockFromUrl#String-URL-BlobRange} * * @param base64BlockID A Base64 encoded {@code String} that specifies the ID for this block. Note that all block * ids for a given blob must be the same length. @@ -219,8 +219,8 @@ base64BlockID, length, data, null, null, null, null, leaseAccessConditions, getC * @param sourceRange {@link BlobRange} * @return A reactive response signalling completion. */ - public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, BlobRange sourceRange) { - return this.stageBlockFromURLWithResponse(base64BlockID, sourceURL, sourceRange, null, null, null) + public Mono stageBlockFromUrl(String base64BlockID, URL sourceURL, BlobRange sourceRange) { + return this.stageBlockFromUrlWithResponse(base64BlockID, sourceURL, sourceRange, null, null, null) .flatMap(FluxUtil::toMono); } @@ -231,7 +231,7 @@ public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, BlobRan * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlockBlobAsyncClient.stageBlockFromURLWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions} + * {@codesnippet com.azure.storage.blob.specialized.BlockBlobAsyncClient.stageBlockFromUrlWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions} * * @param base64BlockID A Base64 encoded {@code String} that specifies the ID for this block. Note that all block * ids for a given blob must be the same length. @@ -247,20 +247,20 @@ public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, BlobRan * @param sourceModifiedAccessConditions {@link SourceModifiedAccessConditions} * @return A reactive response signalling completion. */ - public Mono> stageBlockFromURLWithResponse(String base64BlockID, URL sourceURL, + public Mono> stageBlockFromUrlWithResponse(String base64BlockID, URL sourceURL, BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions) { - return withContext(context -> stageBlockFromURLWithResponse(base64BlockID, sourceURL, sourceRange, + return withContext(context -> stageBlockFromUrlWithResponse(base64BlockID, sourceURL, sourceRange, sourceContentMD5, leaseAccessConditions, sourceModifiedAccessConditions)); } - Mono> stageBlockFromURLWithResponse(String base64BlockID, URL sourceURL, + Mono> stageBlockFromUrlWithResponse(String base64BlockID, URL sourceURL, BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { sourceRange = sourceRange == null ? new BlobRange(0) : sourceRange; return postProcessResponse( - this.azureBlobStorage.blockBlobs().stageBlockFromURLWithRestResponseAsync(null, null, + this.azureBlobStorage.blockBlobs().stageBlockFromUrlWithRestResponseAsync(null, null, base64BlockID, 0, sourceURL, sourceRange.toHeaderValue(), sourceContentMD5, null, null, null, getCustomerProvidedKey(), leaseAccessConditions, sourceModifiedAccessConditions, context)) .map(response -> new SimpleResponse<>(response, null)); @@ -339,23 +339,23 @@ public Mono commitBlockList(List base64BlockIDs) { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlockBlobAsyncClient.commitBlockListWithResponse#List-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.specialized.BlockBlobAsyncClient.commitBlockListWithResponse#List-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions} * * @param base64BlockIDs A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @param metadata Metadata to associate with the blob. * @param tier {@link AccessTier} for the destination blob. * @param accessConditions {@link BlobAccessConditions} * @return A reactive response containing the information of the block blob. */ public Mono> commitBlockListWithResponse(List base64BlockIDs, - BlobHTTPHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions) { + BlobHttpHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions) { return withContext(context -> commitBlockListWithResponse(base64BlockIDs, headers, metadata, tier, accessConditions, context)); } Mono> commitBlockListWithResponse(List base64BlockIDs, - BlobHTTPHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions, + BlobHttpHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobClient.java index 47cba85860b6..14cb92b38071 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlockBlobClient.java @@ -12,7 +12,7 @@ import com.azure.storage.blob.BlobClient; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.BlockBlobItem; import com.azure.storage.blob.models.BlockList; @@ -134,7 +134,7 @@ public BlockBlobItem upload(InputStream data, long length) throws IOException { * @param data The data to write to the blob. * @param length The exact length of the data. It is important that this value match precisely the length of the * data provided in the {@link InputStream}. - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @param metadata Metadata to associate with the blob. * @param tier {@link AccessTier} for the destination blob. * @param accessConditions {@link BlobAccessConditions} @@ -145,7 +145,7 @@ public BlockBlobItem upload(InputStream data, long length) throws IOException { * @throws NullPointerException if the input data is null. * @throws UncheckedIOException If an I/O error occurs */ - public Response uploadWithResponse(InputStream data, long length, BlobHTTPHeaders headers, + public Response uploadWithResponse(InputStream data, long length, BlobHttpHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions, Duration timeout, Context context) { Objects.requireNonNull(data); @@ -221,7 +221,7 @@ public Response stageBlockWithResponse(String base64BlockID, InputStream d * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlockBlobClient.stageBlockFromURL#String-URL-BlobRange} + * {@codesnippet com.azure.storage.blob.specialized.BlockBlobClient.stageBlockFromUrl#String-URL-BlobRange} * * @param base64BlockID A Base64 encoded {@code String} that specifies the ID for this block. Note that all block * ids for a given blob must be the same length. @@ -231,8 +231,8 @@ public Response stageBlockWithResponse(String base64BlockID, InputStream d * authentication is required to perform the operation. * @param sourceRange {@link BlobRange} */ - public void stageBlockFromURL(String base64BlockID, URL sourceURL, BlobRange sourceRange) { - stageBlockFromURLWithResponse(base64BlockID, sourceURL, sourceRange, null, null, null, null, Context.NONE); + public void stageBlockFromUrl(String base64BlockID, URL sourceURL, BlobRange sourceRange) { + stageBlockFromUrlWithResponse(base64BlockID, sourceURL, sourceRange, null, null, null, null, Context.NONE); } /** @@ -242,7 +242,7 @@ public void stageBlockFromURL(String base64BlockID, URL sourceURL, BlobRange sou * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlockBlobClient.stageBlockFromURLWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions-Duration-Context} + * {@codesnippet com.azure.storage.blob.specialized.BlockBlobClient.stageBlockFromUrlWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions-Duration-Context} * * @param base64BlockID A Base64 encoded {@code String} that specifies the ID for this block. Note that all block * ids for a given blob must be the same length. @@ -260,10 +260,10 @@ public void stageBlockFromURL(String base64BlockID, URL sourceURL, BlobRange sou * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing status code and HTTP headers */ - public Response stageBlockFromURLWithResponse(String base64BlockID, URL sourceURL, BlobRange sourceRange, + public Response stageBlockFromUrlWithResponse(String base64BlockID, URL sourceURL, BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Duration timeout, Context context) { - Mono> response = blockBlobAsyncClient.stageBlockFromURLWithResponse(base64BlockID, sourceURL, + Mono> response = blockBlobAsyncClient.stageBlockFromUrlWithResponse(base64BlockID, sourceURL, sourceRange, sourceContentMD5, leaseAccessConditions, sourceModifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -337,10 +337,10 @@ public BlockBlobItem commitBlockList(List base64BlockIDs) { * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.BlockBlobClient.uploadFromFile#List-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions-Duration-Context} + * {@codesnippet com.azure.storage.blob.specialized.BlockBlobClient.uploadFromFile#List-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions-Duration-Context} * * @param base64BlockIDs A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @param metadata Metadata to associate with the blob. * @param tier {@link AccessTier} for the destination blob. * @param accessConditions {@link BlobAccessConditions} @@ -349,7 +349,7 @@ public BlockBlobItem commitBlockList(List base64BlockIDs) { * @return The information of the block blob. */ public Response commitBlockListWithResponse(List base64BlockIDs, - BlobHTTPHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions, + BlobHttpHeaders headers, Map metadata, AccessTier tier, BlobAccessConditions accessConditions, Duration timeout, Context context) { Mono> response = blockBlobAsyncClient.commitBlockListWithResponse( base64BlockIDs, headers, metadata, tier, accessConditions, context); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobAsyncClient.java index d0fe10128c96..f211de774c41 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/PageBlobAsyncClient.java @@ -13,7 +13,7 @@ import com.azure.storage.blob.BlobAsyncClient; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.CopyStatusType; import com.azure.storage.blob.models.CpkInfo; @@ -104,20 +104,20 @@ public Mono create(long size) { * 512-byte boundary. * @param sequenceNumber A user-controlled value that you can use to track requests. The value of the sequence * number must be between 0 and 2^63 - 1.The default value is 0. - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @param metadata Metadata to associate with the blob. * @param accessConditions {@link BlobAccessConditions} * @return A reactive response containing the information of the created page blob. * @throws IllegalArgumentException If {@code size} isn't a multiple of {@link PageBlobAsyncClient#PAGE_BYTES} or * {@code sequenceNumber} isn't null and is less than 0. */ - public Mono> createWithResponse(long size, Long sequenceNumber, BlobHTTPHeaders headers, + public Mono> createWithResponse(long size, Long sequenceNumber, BlobHttpHeaders headers, Map metadata, BlobAccessConditions accessConditions) { return withContext(context -> createWithResponse(size, sequenceNumber, headers, metadata, accessConditions, context)); } - Mono> createWithResponse(long size, Long sequenceNumber, BlobHTTPHeaders headers, + Mono> createWithResponse(long size, Long sequenceNumber, BlobHttpHeaders headers, Map metadata, BlobAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; @@ -217,7 +217,7 @@ Mono> uploadPagesWithResponse(PageRange pageRange, FluxCode Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromURL#PageRange-URL-Long} + * {@codesnippet com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromUrl#PageRange-URL-Long} * * @param range 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 @@ -230,8 +230,8 @@ Mono> uploadPagesWithResponse(PageRange pageRange, Flux uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset) { - return uploadPagesFromURLWithResponse(range, sourceURL, sourceOffset, null, null, null) + public Mono uploadPagesFromUrl(PageRange range, URL sourceURL, Long sourceOffset) { + return uploadPagesFromUrlWithResponse(range, sourceURL, sourceOffset, null, null, null) .flatMap(FluxUtil::toMono); } @@ -242,7 +242,7 @@ public Mono uploadPagesFromURL(PageRange range, URL sourceURL, Lon * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromURLWithResponse#PageRange-URL-Long-byte-PageBlobAccessConditions-SourceModifiedAccessConditions} + * {@codesnippet com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromUrlWithResponse#PageRange-URL-Long-byte-PageBlobAccessConditions-SourceModifiedAccessConditions} * * @param range The destination {@link PageRange} range. 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 @@ -259,14 +259,14 @@ public Mono uploadPagesFromURL(PageRange range, URL sourceURL, Lon * @return A reactive response containing the information of the uploaded pages. * @throws IllegalArgumentException If {@code range} is {@code null} */ - public Mono> uploadPagesFromURLWithResponse(PageRange range, URL sourceURL, + public Mono> uploadPagesFromUrlWithResponse(PageRange range, URL sourceURL, Long sourceOffset, byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, SourceModifiedAccessConditions sourceAccessConditions) { - return withContext(context -> uploadPagesFromURLWithResponse(range, sourceURL, sourceOffset, sourceContentMD5, + return withContext(context -> uploadPagesFromUrlWithResponse(range, sourceURL, sourceOffset, sourceContentMD5, destAccessConditions, sourceAccessConditions, context)); } - Mono> uploadPagesFromURLWithResponse(PageRange range, URL sourceURL, Long sourceOffset, + Mono> uploadPagesFromUrlWithResponse(PageRange range, URL sourceURL, Long sourceOffset, byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, SourceModifiedAccessConditions sourceAccessConditions, Context context) { if (range == null) { @@ -287,7 +287,7 @@ Mono> uploadPagesFromURLWithResponse(PageRange range, URL destAccessConditions = destAccessConditions == null ? new PageBlobAccessConditions() : destAccessConditions; - return postProcessResponse(this.azureBlobStorage.pageBlobs().uploadPagesFromURLWithRestResponseAsync(null, null, + return postProcessResponse(this.azureBlobStorage.pageBlobs().uploadPagesFromUrlWithRestResponseAsync(null, null, sourceURL, sourceRangeString, 0, rangeString, sourceContentMD5, null, null, null, getCustomerProvidedKey(), destAccessConditions.getLeaseAccessConditions(), destAccessConditions.getSequenceNumberAccessConditions(), destAccessConditions.getModifiedAccessConditions(), sourceAccessConditions, context)) @@ -607,7 +607,7 @@ Mono> copyIncrementalWithResponse(URL source, String sn UrlBuilder builder = UrlBuilder.parse(source); builder.setQueryParameter(Constants.SNAPSHOT_QUERY_PARAMETER, snapshot); try { - source = builder.toURL(); + source = builder.toUrl(); } catch (MalformedURLException e) { // We are parsing a valid url and adding a query parameter. If this fails, we can't recover. throw logger.logExceptionAsError(new IllegalStateException(e)); 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 d017156fc765..0724c22afb61 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 @@ -9,7 +9,7 @@ import com.azure.core.util.Context; import com.azure.storage.blob.BlobClient; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.CopyStatusType; import com.azure.storage.blob.models.ModifiedAccessConditions; @@ -126,14 +126,14 @@ public PageBlobItem create(long size) { * 512-byte boundary. * @param sequenceNumber A user-controlled value that you can use to track requests. The value of the sequence * number must be between 0 and 2^63 - 1.The default value is 0. - * @param headers {@link BlobHTTPHeaders} + * @param headers {@link BlobHttpHeaders} * @param metadata Metadata to associate with the blob. * @param accessConditions {@link BlobAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @param context Additional context that is passed through the Http pipeline during the service call. * @return The information of the created page blob. */ - public Response createWithResponse(long size, Long sequenceNumber, BlobHTTPHeaders headers, + public Response createWithResponse(long size, Long sequenceNumber, BlobHttpHeaders headers, Map metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) { Mono> response = pageBlobAsyncClient.createWithResponse(size, sequenceNumber, headers, metadata, accessConditions, context); @@ -204,7 +204,7 @@ public Response uploadPagesWithResponse(PageRange pageRange, Input * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.PageBlobClient.uploadPagesFromURL#PageRange-URL-Long} + * {@codesnippet com.azure.storage.blob.specialized.PageBlobClient.uploadPagesFromUrl#PageRange-URL-Long} * * @param range 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 @@ -217,8 +217,8 @@ public Response uploadPagesWithResponse(PageRange pageRange, Input * blob. * @return The information of the uploaded pages. */ - public PageBlobItem uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset) { - return uploadPagesFromURLWithResponse(range, sourceURL, sourceOffset, null, null, null, null, Context.NONE) + public PageBlobItem uploadPagesFromUrl(PageRange range, URL sourceURL, Long sourceOffset) { + return uploadPagesFromUrlWithResponse(range, sourceURL, sourceOffset, null, null, null, null, Context.NONE) .getValue(); } @@ -229,7 +229,7 @@ public PageBlobItem uploadPagesFromURL(PageRange range, URL sourceURL, Long sour * *

    Code Samples

    * - * {@codesnippet com.azure.storage.blob.specialized.PageBlobClient.uploadPagesFromURLWithResponse#PageRange-URL-Long-byte-PageBlobAccessConditions-SourceModifiedAccessConditions-Duration-Context} + * {@codesnippet com.azure.storage.blob.specialized.PageBlobClient.uploadPagesFromUrlWithResponse#PageRange-URL-Long-byte-PageBlobAccessConditions-SourceModifiedAccessConditions-Duration-Context} * * @param range The destination {@link PageRange} range. 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 @@ -247,11 +247,11 @@ public PageBlobItem uploadPagesFromURL(PageRange range, URL sourceURL, Long sour * @param context Additional context that is passed through the Http pipeline during the service call. * @return The information of the uploaded pages. */ - public Response uploadPagesFromURLWithResponse(PageRange range, URL sourceURL, Long sourceOffset, + public Response uploadPagesFromUrlWithResponse(PageRange range, URL sourceURL, Long sourceOffset, byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, SourceModifiedAccessConditions sourceAccessConditions, Duration timeout, Context context) { - Mono> response = pageBlobAsyncClient.uploadPagesFromURLWithResponse(range, sourceURL, + Mono> response = pageBlobAsyncClient.uploadPagesFromUrlWithResponse(range, sourceURL, sourceOffset, sourceContentMD5, destAccessConditions, sourceAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } 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 4fad58a9aa1a..26bf52c5fa06 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 @@ -5,7 +5,7 @@ import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; import com.azure.storage.blob.models.LeaseAccessConditions; @@ -52,31 +52,31 @@ public void existsCodeSnippet() { } /** - * Code snippets for {@link BlobAsyncClient#startCopyFromURL(URL)} + * Code snippets for {@link BlobAsyncClient#startCopyFromUrl(URL)} */ - public void startCopyFromURLCodeSnippet() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL - client.startCopyFromURL(url) + public void startCopyFromUrlCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromUrl#URL + client.startCopyFromUrl(url) .subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); - // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL + // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromUrl#URL } /** - * Code snippets for {@link BlobAsyncClient#abortCopyFromURL(String)} + * Code snippets for {@link BlobAsyncClient#abortCopyFromUrl(String)} */ - public void abortCopyFromURLCodeSnippet() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String - client.abortCopyFromURL(copyId).doOnSuccess(response -> System.out.println("Aborted copy from URL")); - // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String + public void abortCopyFromUrlCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromUrl#String + client.abortCopyFromUrl(copyId).doOnSuccess(response -> System.out.println("Aborted copy from URL")); + // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromUrl#String } /** - * Code snippets for {@link BlobAsyncClient#copyFromURL(URL)} + * Code snippets for {@link BlobAsyncClient#copyFromUrl(URL)} */ - public void copyFromURLCodeSnippet() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL - client.copyFromURL(url).subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); - // END: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL + public void copyFromUrlCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromUrl#URL + client.copyFromUrl(url).subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); + // END: com.azure.storage.blob.BlobAsyncClient.copyFromUrl#URL } /** @@ -159,14 +159,14 @@ public void getPropertiesCodeSnippet() { } /** - * Code snippets for {@link BlobAsyncClient#setHTTPHeaders(BlobHTTPHeaders)} + * Code snippets for {@link BlobAsyncClient#setHttpHeaders(BlobHttpHeaders)} */ - public void setHTTPHeadersCodeSnippet() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders - client.setHTTPHeaders(new BlobHTTPHeaders() + public void setHttpHeadersCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHttpHeaders#BlobHTTPHeaders + client.setHttpHeaders(new BlobHttpHeaders() .setBlobContentLanguage("en-US") .setBlobContentType("binary")); - // END: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders + // END: com.azure.storage.blob.BlobAsyncClient.setHttpHeaders#BlobHTTPHeaders } /** @@ -227,53 +227,53 @@ public void existsWithResponseCodeSnippet() { } /** - * Code snippets for {@link BlobAsyncClient#startCopyFromURLWithResponse(URL, Map, AccessTier, + * Code snippets for {@link BlobAsyncClient#startCopyFromUrlWithResponse(URL, Map, AccessTier, * RehydratePriority, ModifiedAccessConditions, BlobAccessConditions)} */ - public void startCopyFromURLWithResponseCodeSnippets() { + public void startCopyFromUrlWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURLWithResponse#URL-Metadata-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions + // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromUrlWithResponse#URL-Metadata-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions Map metadata = Collections.singletonMap("metadata", "value"); ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(7)); BlobAccessConditions blobAccessConditions = new BlobAccessConditions() .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)); - client.startCopyFromURLWithResponse(url, metadata, AccessTier.HOT, RehydratePriority.STANDARD, + client.startCopyFromUrlWithResponse(url, metadata, AccessTier.HOT, RehydratePriority.STANDARD, modifiedAccessConditions, blobAccessConditions) .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.getValue())); - // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromURLWithResponse#URL-Metadata-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions + // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromUrlWithResponse#URL-Metadata-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#abortCopyFromURLWithResponse(String, LeaseAccessConditions)} + * Code snippets for {@link BlobAsyncClient#abortCopyFromUrlWithResponse(String, LeaseAccessConditions)} */ - public void abortCopyFromURLWithResponseCodeSnippets() { + public void abortCopyFromUrlWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions + // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromUrlWithResponse#String-LeaseAccessConditions LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().setLeaseId(leaseId); - client.abortCopyFromURLWithResponse(copyId, leaseAccessConditions) + client.abortCopyFromUrlWithResponse(copyId, leaseAccessConditions) .subscribe( response -> System.out.printf("Aborted copy completed with status %d%n", response.getStatusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions + // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromUrlWithResponse#String-LeaseAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#copyFromURLWithResponse(URL, Map, AccessTier, + * Code snippets for {@link BlobAsyncClient#copyFromUrlWithResponse(URL, Map, AccessTier, * ModifiedAccessConditions, BlobAccessConditions)} */ - public void copyFromURLWithResponseCodeSnippets() { + public void copyFromUrlWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURLWithResponse#URL-Metadata-AccessTier-ModifiedAccessConditions-BlobAccessConditions + // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromUrlWithResponse#URL-Metadata-AccessTier-ModifiedAccessConditions-BlobAccessConditions Map metadata = Collections.singletonMap("metadata", "value"); ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(7)); BlobAccessConditions blobAccessConditions = new BlobAccessConditions() .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)); - client.copyFromURLWithResponse(url, metadata, AccessTier.HOT, modifiedAccessConditions, blobAccessConditions) + client.copyFromUrlWithResponse(url, metadata, AccessTier.HOT, modifiedAccessConditions, blobAccessConditions) .subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); - // END: com.azure.storage.blob.BlobAsyncClient.copyFromURLWithResponse#URL-Metadata-AccessTier-ModifiedAccessConditions-BlobAccessConditions + // END: com.azure.storage.blob.BlobAsyncClient.copyFromUrlWithResponse#URL-Metadata-AccessTier-ModifiedAccessConditions-BlobAccessConditions } /** @@ -327,21 +327,21 @@ public void getPropertiesWithResponseCodeSnippets() { } /** - * Code snippets for {@link BlobAsyncClient#setHTTPHeadersWithResponse(BlobHTTPHeaders, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#setHttpHeadersWithResponse(BlobHttpHeaders, BlobAccessConditions)} */ - public void setHTTPHeadersWithResponseCodeSnippets() { + public void setHttpHeadersWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHttpHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions BlobAccessConditions accessConditions = new BlobAccessConditions() .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)); - client.setHTTPHeadersWithResponse(new BlobHTTPHeaders() + client.setHttpHeadersWithResponse(new BlobHttpHeaders() .setBlobContentLanguage("en-US") .setBlobContentType("binary"), accessConditions).subscribe( response -> System.out.printf("Set HTTP headers completed with status %d%n", response.getStatusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions + // END: com.azure.storage.blob.BlobAsyncClient.setHttpHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions } /** @@ -441,11 +441,11 @@ public void upload3() { } /** - * Code snippet for {@link BlobAsyncClient#uploadWithResponse(Flux, ParallelTransferOptions, BlobHTTPHeaders, Map, AccessTier, BlobAccessConditions)} + * Code snippet for {@link BlobAsyncClient#uploadWithResponse(Flux, ParallelTransferOptions, BlobHttpHeaders, Map, AccessTier, BlobAccessConditions)} */ public void upload4() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.uploadWithResponse#Flux-ParallelTransferOptions-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions - BlobHTTPHeaders headers = new BlobHTTPHeaders() + // BEGIN: com.azure.storage.blob.BlobAsyncClient.uploadWithResponse#Flux-ParallelTransferOptions-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions + BlobHttpHeaders headers = new BlobHttpHeaders() .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) .setBlobContentLanguage("en-US") .setBlobContentType("binary"); @@ -463,7 +463,7 @@ public void upload4() { client.uploadWithResponse(data, parallelTransferOptions, headers, metadata, AccessTier.HOT, accessConditions) .subscribe(response -> System.out.printf("Uploaded BlockBlob MD5 is %s%n", Base64.getEncoder().encodeToString(response.getValue().getContentMD5()))); - // END: com.azure.storage.blob.BlobAsyncClient.uploadWithResponse#Flux-ParallelTransferOptions-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions + // END: com.azure.storage.blob.BlobAsyncClient.uploadWithResponse#Flux-ParallelTransferOptions-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions } /** @@ -478,11 +478,11 @@ public void uploadFromFile() { } /** - * Code snippet for {@link BlobAsyncClient#uploadFromFile(String, ParallelTransferOptions, BlobHTTPHeaders, Map, AccessTier, BlobAccessConditions)} + * Code snippet for {@link BlobAsyncClient#uploadFromFile(String, ParallelTransferOptions, BlobHttpHeaders, Map, AccessTier, BlobAccessConditions)} */ public void uploadFromFile2() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.uploadFromFile#String-ParallelTransferOptions-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions - BlobHTTPHeaders headers = new BlobHTTPHeaders() + // BEGIN: com.azure.storage.blob.BlobAsyncClient.uploadFromFile#String-ParallelTransferOptions-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions + BlobHttpHeaders headers = new BlobHttpHeaders() .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) .setBlobContentLanguage("en-US") .setBlobContentType("binary"); @@ -498,7 +498,7 @@ public void uploadFromFile2() { headers, metadata, AccessTier.HOT, accessConditions) .doOnError(throwable -> System.err.printf("Failed to upload from file %s%n", throwable.getMessage())) .subscribe(completion -> System.out.println("Upload from file succeeded")); - // END: com.azure.storage.blob.BlobAsyncClient.uploadFromFile#String-ParallelTransferOptions-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions + // END: com.azure.storage.blob.BlobAsyncClient.uploadFromFile#String-ParallelTransferOptions-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions } } 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 e68edcee67ac..e076951ce03e 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 @@ -6,7 +6,7 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; import com.azure.storage.blob.models.LeaseAccessConditions; @@ -55,31 +55,31 @@ public void existsCodeSnippet() { } /** - * Code snippets for {@link BlobClient#startCopyFromURL(URL)} + * Code snippets for {@link BlobClient#startCopyFromUrl(URL)} */ - public void startCopyFromURL() { - // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromURL#URL - System.out.printf("Copy identifier: %s%n", client.startCopyFromURL(url)); - // END: com.azure.storage.blob.BlobClient.startCopyFromURL#URL + public void startCopyFromUrl() { + // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromUrl#URL + System.out.printf("Copy identifier: %s%n", client.startCopyFromUrl(url)); + // END: com.azure.storage.blob.BlobClient.startCopyFromUrl#URL } /** - * Code snippets for {@link BlobClient#abortCopyFromURL(String)} + * Code snippets for {@link BlobClient#abortCopyFromUrl(String)} */ - public void abortCopyFromURL() { - // BEGIN: com.azure.storage.blob.BlobClient.abortCopyFromURL#String - client.abortCopyFromURL(copyId); + public void abortCopyFromUrl() { + // BEGIN: com.azure.storage.blob.BlobClient.abortCopyFromUrl#String + client.abortCopyFromUrl(copyId); System.out.println("Aborted copy completed."); - // END: com.azure.storage.blob.BlobClient.abortCopyFromURL#String + // END: com.azure.storage.blob.BlobClient.abortCopyFromUrl#String } /** - * Code snippets for {@link BlobClient#copyFromURL(URL)} + * Code snippets for {@link BlobClient#copyFromUrl(URL)} */ - public void copyFromURL() { - // BEGIN: com.azure.storage.blob.BlobClient.copyFromURL#URL - System.out.printf("Copy identifier: %s%n", client.copyFromURL(url)); - // END: com.azure.storage.blob.BlobClient.copyFromURL#URL + public void copyFromUrl() { + // BEGIN: com.azure.storage.blob.BlobClient.copyFromUrl#URL + System.out.printf("Copy identifier: %s%n", client.copyFromUrl(url)); + // END: com.azure.storage.blob.BlobClient.copyFromUrl#URL } /** @@ -133,15 +133,15 @@ public void getProperties() { } /** - * Code snippets for {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders)} + * Code snippets for {@link BlobClient#setHttpHeaders(BlobHttpHeaders)} */ - public void setHTTPHeaders() { - // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders - client.setHTTPHeaders(new BlobHTTPHeaders() + public void setHttpHeaders() { + // BEGIN: com.azure.storage.blob.BlobClient.setHttpHeaders#BlobHTTPHeaders + client.setHttpHeaders(new BlobHttpHeaders() .setBlobContentLanguage("en-US") .setBlobContentType("binary")); System.out.println("Set HTTP headers completed"); - // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders + // END: com.azure.storage.blob.BlobClient.setHttpHeaders#BlobHTTPHeaders } /** @@ -206,12 +206,12 @@ public void existsWithResponseCodeSnippet() { } /** - * Code snippets for {@link BlobClient#startCopyFromURLWithResponse(URL, Map, AccessTier, RehydratePriority, + * Code snippets for {@link BlobClient#startCopyFromUrlWithResponse(URL, Map, AccessTier, RehydratePriority, * ModifiedAccessConditions, BlobAccessConditions, Duration, Context)} */ - public void startCopyFromURLWithResponseCodeSnippets() { + public void startCopyFromUrlWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromURLWithResponse#URL-Metadata-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromUrlWithResponse#URL-Metadata-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions-Duration-Context Map metadata = Collections.singletonMap("metadata", "value"); ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(7)); @@ -219,32 +219,32 @@ public void startCopyFromURLWithResponseCodeSnippets() { new LeaseAccessConditions().setLeaseId(leaseId)); System.out.printf("Copy identifier: %s%n", - client.startCopyFromURLWithResponse(url, metadata, AccessTier.HOT, RehydratePriority.STANDARD, + client.startCopyFromUrlWithResponse(url, metadata, AccessTier.HOT, RehydratePriority.STANDARD, modifiedAccessConditions, blobAccessConditions, timeout, new Context(key2, value2))); - // END: com.azure.storage.blob.BlobClient.startCopyFromURLWithResponse#URL-Metadata-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + // END: com.azure.storage.blob.BlobClient.startCopyFromUrlWithResponse#URL-Metadata-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#abortCopyFromURLWithResponse(String, LeaseAccessConditions, Duration, Context)} + * Code snippets for {@link BlobClient#abortCopyFromUrlWithResponse(String, LeaseAccessConditions, Duration, Context)} */ - public void abortCopyFromURLWithResponseCodeSnippets() { + public void abortCopyFromUrlWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions-Duration-Context + // BEGIN: com.azure.storage.blob.BlobClient.abortCopyFromUrlWithResponse#String-LeaseAccessConditions-Duration-Context LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().setLeaseId(leaseId); System.out.printf("Aborted copy completed with status %d%n", - client.abortCopyFromURLWithResponse(copyId, leaseAccessConditions, timeout, + client.abortCopyFromUrlWithResponse(copyId, leaseAccessConditions, timeout, new Context(key2, value2)).getStatusCode()); - // END: com.azure.storage.blob.BlobClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions-Duration-Context + // END: com.azure.storage.blob.BlobClient.abortCopyFromUrlWithResponse#String-LeaseAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClient#copyFromURLWithResponse(URL, Map, AccessTier, ModifiedAccessConditions, + * Code snippets for {@link BlobClient#copyFromUrlWithResponse(URL, Map, AccessTier, ModifiedAccessConditions, * BlobAccessConditions, Duration, Context)} */ - public void copyFromURLWithResponseCodeSnippets() { + public void copyFromUrlWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobClient.copyFromURLWithResponse#URL-Metadata-AccessTier-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + // BEGIN: com.azure.storage.blob.BlobClient.copyFromUrlWithResponse#URL-Metadata-AccessTier-ModifiedAccessConditions-BlobAccessConditions-Duration-Context Map metadata = Collections.singletonMap("metadata", "value"); ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(7)); @@ -252,10 +252,10 @@ public void copyFromURLWithResponseCodeSnippets() { new LeaseAccessConditions().setLeaseId(leaseId)); System.out.printf("Copy identifier: %s%n", - client.copyFromURLWithResponse(url, metadata, AccessTier.HOT, modifiedAccessConditions, + client.copyFromUrlWithResponse(url, metadata, AccessTier.HOT, modifiedAccessConditions, blobAccessConditions, timeout, new Context(key1, value1)).getValue()); - // END: com.azure.storage.blob.BlobClient.copyFromURLWithResponse#URL-Metadata-AccessTier-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + // END: com.azure.storage.blob.BlobClient.copyFromUrlWithResponse#URL-Metadata-AccessTier-ModifiedAccessConditions-BlobAccessConditions-Duration-Context } /** @@ -304,20 +304,20 @@ public void getPropertiesWithResponseCodeSnippets() { } /** - * Code snippets for {@link BlobClient#setHTTPHeadersWithResponse(BlobHTTPHeaders, BlobAccessConditions, Duration, + * Code snippets for {@link BlobClient#setHttpHeadersWithResponse(BlobHttpHeaders, BlobAccessConditions, Duration, * Context)} */ - public void setHTTPHeadersWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context + public void setHttpHeadersWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.setHttpHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context BlobAccessConditions accessConditions = new BlobAccessConditions() .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)); System.out.printf("Set HTTP headers completed with status %d%n", - client.setHTTPHeadersWithResponse(new BlobHTTPHeaders() + client.setHttpHeadersWithResponse(new BlobHttpHeaders() .setBlobContentLanguage("en-US") .setBlobContentType("binary"), accessConditions, timeout, new Context(key1, value1)) .getStatusCode()); - // END: com.azure.storage.blob.BlobClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context + // END: com.azure.storage.blob.BlobClient.setHttpHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context } /** @@ -421,13 +421,13 @@ public void uploadFromFile() throws IOException { } /** - * Code snippet for {@link BlobClient#uploadFromFile(String, ParallelTransferOptions, BlobHTTPHeaders, Map, AccessTier, BlobAccessConditions, Duration)} + * Code snippet for {@link BlobClient#uploadFromFile(String, ParallelTransferOptions, BlobHttpHeaders, Map, AccessTier, BlobAccessConditions, Duration)} * * @throws IOException If an I/O error occurs */ public void uploadFromFile2() throws IOException { - // BEGIN: com.azure.storage.blob.BlobClient.uploadFromFile#String-ParallelTransferOptions-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions-Duration - BlobHTTPHeaders headers = new BlobHTTPHeaders() + // BEGIN: com.azure.storage.blob.BlobClient.uploadFromFile#String-ParallelTransferOptions-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions-Duration + BlobHttpHeaders headers = new BlobHttpHeaders() .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) .setBlobContentLanguage("en-US") .setBlobContentType("binary"); @@ -447,6 +447,6 @@ public void uploadFromFile2() throws IOException { } catch (UncheckedIOException ex) { System.err.printf("Failed to upload from file %s%n", ex.getMessage()); } - // END: com.azure.storage.blob.BlobClient.uploadFromFile#String-ParallelTransferOptions-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions-Duration + // END: com.azure.storage.blob.BlobClient.uploadFromFile#String-ParallelTransferOptions-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions-Duration } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java index 4720320b7a36..663b5b1db536 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java @@ -4,7 +4,7 @@ package com.azure.storage.blob; import com.azure.core.util.Context; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.specialized.BlockBlobClient; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -20,7 +20,7 @@ * This example shows how to set metadata for containers and blobs and how to set HTTPHeaders for blobs using the Azure * Storage Blob SDK for Java. */ -public class SetMetadataAndHTTPHeadersExample { +public class SetMetadataAndHttpHeadersExample { /** * Entry point into the setting metadata examples for Storage blobs. @@ -72,7 +72,7 @@ public static void main(String[] args) throws IOException { * Create a blob with blob's blobMetadata and BlobHttpHeaders. */ Map blobMetadata = Collections.singletonMap("myblobmetadata", "sample"); - BlobHTTPHeaders blobHTTPHeaders = new BlobHTTPHeaders().setBlobContentDisposition("attachment") + BlobHttpHeaders blobHTTPHeaders = new BlobHttpHeaders().setBlobContentDisposition("attachment") .setBlobContentType("text/html; charset=utf-8"); /* diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/AppendBlobAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/AppendBlobAsyncClientJavaDocCodeSnippets.java index 7e7ee85555a6..fbd0800ce4fc 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/AppendBlobAsyncClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/AppendBlobAsyncClientJavaDocCodeSnippets.java @@ -6,7 +6,7 @@ import com.azure.storage.blob.models.AppendBlobAccessConditions; import com.azure.storage.blob.models.AppendPositionAccessConditions; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.ModifiedAccessConditions; @@ -52,11 +52,11 @@ public void create() { } /** - * Code snippet for {@link AppendBlobAsyncClient#createWithResponse(BlobHTTPHeaders, Map, BlobAccessConditions)} + * Code snippet for {@link AppendBlobAsyncClient#createWithResponse(BlobHttpHeaders, Map, BlobAccessConditions)} */ public void create2() { // BEGIN: com.azure.storage.blob.specialized.AppendBlobAsyncClient.createWithResponse#BlobHTTPHeaders-Map-BlobAccessConditions - BlobHTTPHeaders headers = new BlobHTTPHeaders() + BlobHttpHeaders headers = new BlobHttpHeaders() .setBlobContentType("binary") .setBlobContentLanguage("en-US"); Map metadata = Collections.singletonMap("metadata", "value"); diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/AppendBlobClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/AppendBlobClientJavaDocCodeSnippets.java index d8904cb25a1e..aabb1dc0840d 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/AppendBlobClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/AppendBlobClientJavaDocCodeSnippets.java @@ -7,7 +7,7 @@ import com.azure.storage.blob.models.AppendBlobAccessConditions; import com.azure.storage.blob.models.AppendPositionAccessConditions; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.ModifiedAccessConditions; @@ -55,12 +55,12 @@ public void create() { } /** - * Code snippet for {@link AppendBlobClient#createWithResponse(BlobHTTPHeaders, Map, BlobAccessConditions, + * Code snippet for {@link AppendBlobClient#createWithResponse(BlobHttpHeaders, Map, BlobAccessConditions, * Duration, Context)} */ public void createWithResponse() { - // BEGIN: com.azure.storage.blob.specialized.AppendBlobClient.createWithResponse#BlobHTTPHeaders-Map-BlobAccessConditions-Duration-Context - BlobHTTPHeaders headers = new BlobHTTPHeaders() + // BEGIN: com.azure.storage.blob.specialized.AppendBlobClient.createWithResponse#BlobHttpHeaders-Map-BlobAccessConditions-Duration-Context + BlobHttpHeaders headers = new BlobHttpHeaders() .setBlobContentType("binary") .setBlobContentLanguage("en-US"); Map metadata = Collections.singletonMap("metadata", "value"); @@ -72,7 +72,7 @@ public void createWithResponse() { System.out.printf("Created AppendBlob at %s%n", client.createWithResponse(headers, metadata, accessConditions, timeout, context).getValue().getLastModified()); - // END: com.azure.storage.blob.specialized.AppendBlobClient.createWithResponse#BlobHTTPHeaders-Map-BlobAccessConditions-Duration-Context + // END: com.azure.storage.blob.specialized.AppendBlobClient.createWithResponse#BlobHttpHeaders-Map-BlobAccessConditions-Duration-Context } /** 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 7441ed1670f9..fb916c250d55 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlobAsyncClientBaseJavaDocCodeSnippets.java @@ -5,7 +5,7 @@ import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; import com.azure.storage.blob.models.LeaseAccessConditions; @@ -49,31 +49,31 @@ public void existsCodeSnippet() { } /** - * Code snippets for {@link BlobAsyncClientBase#startCopyFromURL(URL)} + * Code snippets for {@link BlobAsyncClientBase#startCopyFromUrl(URL)} */ - public void startCopyFromURLCodeSnippet() { - // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.startCopyFromURL#URL - client.startCopyFromURL(url) + public void startCopyFromUrlCodeSnippet() { + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.startCopyFromUrl#URL + client.startCopyFromUrl(url) .subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); - // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.startCopyFromURL#URL + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.startCopyFromUrl#URL } /** - * Code snippets for {@link BlobAsyncClientBase#abortCopyFromURL(String)} + * Code snippets for {@link BlobAsyncClientBase#abortCopyFromUrl(String)} */ - public void abortCopyFromURLCodeSnippet() { - // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.abortCopyFromURL#String - client.abortCopyFromURL(copyId).doOnSuccess(response -> System.out.println("Aborted copy from URL")); - // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.abortCopyFromURL#String + public void abortCopyFromUrlCodeSnippet() { + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.abortCopyFromUrl#String + client.abortCopyFromUrl(copyId).doOnSuccess(response -> System.out.println("Aborted copy from URL")); + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.abortCopyFromUrl#String } /** - * Code snippets for {@link BlobAsyncClientBase#copyFromURL(URL)} + * Code snippets for {@link BlobAsyncClientBase#copyFromUrl(URL)} */ - public void copyFromURLCodeSnippet() { - // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.copyFromURL#URL - client.copyFromURL(url).subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); - // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.copyFromURL#URL + public void copyFromUrlCodeSnippet() { + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.copyFromUrl#URL + client.copyFromUrl(url).subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.copyFromUrl#URL } /** @@ -157,14 +157,14 @@ public void getPropertiesCodeSnippet() { } /** - * Code snippets for {@link BlobAsyncClientBase#setHTTPHeaders(BlobHTTPHeaders)} + * Code snippets for {@link BlobAsyncClientBase#setHttpHeaders(BlobHttpHeaders)} */ - public void setHTTPHeadersCodeSnippet() { - // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.setHTTPHeaders#BlobHTTPHeaders - client.setHTTPHeaders(new BlobHTTPHeaders() + public void setHttpHeadersCodeSnippet() { + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.setHttpHeaders#BlobHttpHeaders + client.setHttpHeaders(new BlobHttpHeaders() .setBlobContentLanguage("en-US") .setBlobContentType("binary")); - // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.setHTTPHeaders#BlobHTTPHeaders + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.setHttpHeaders#BlobHttpHeaders } /** @@ -225,52 +225,52 @@ public void existsWithResponseCodeSnippet() { } /** - * Code snippets for {@link BlobAsyncClientBase#startCopyFromURLWithResponse(URL, Map, AccessTier, + * Code snippets for {@link BlobAsyncClientBase#startCopyFromUrlWithResponse(URL, Map, AccessTier, * RehydratePriority, ModifiedAccessConditions, BlobAccessConditions)} */ - public void startCopyFromURLWithResponseCodeSnippets() { + public void startCopyFromUrlWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.startCopyFromURLWithResponse#URL-Map-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.startCopyFromUrlWithResponse#URL-Map-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions Map metadata = Collections.singletonMap("metadata", "value"); ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(7)); BlobAccessConditions blobAccessConditions = new BlobAccessConditions() .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)); - client.startCopyFromURLWithResponse(url, metadata, AccessTier.HOT, RehydratePriority.STANDARD, + client.startCopyFromUrlWithResponse(url, metadata, AccessTier.HOT, RehydratePriority.STANDARD, modifiedAccessConditions, blobAccessConditions) .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.getValue())); - // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.startCopyFromURLWithResponse#URL-Map-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.startCopyFromUrlWithResponse#URL-Map-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClientBase#abortCopyFromURLWithResponse(String, LeaseAccessConditions)} + * Code snippets for {@link BlobAsyncClientBase#abortCopyFromUrlWithResponse(String, LeaseAccessConditions)} */ - public void abortCopyFromURLWithResponseCodeSnippets() { + public void abortCopyFromUrlWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.abortCopyFromURLWithResponse#String-LeaseAccessConditions + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.abortCopyFromUrlWithResponse#String-LeaseAccessConditions LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().setLeaseId(leaseId); - client.abortCopyFromURLWithResponse(copyId, leaseAccessConditions) + client.abortCopyFromUrlWithResponse(copyId, leaseAccessConditions) .subscribe(response -> System.out.printf("Aborted copy completed with status %d%n", response.getStatusCode())); - // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.abortCopyFromURLWithResponse#String-LeaseAccessConditions + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.abortCopyFromUrlWithResponse#String-LeaseAccessConditions } /** - * Code snippets for {@link BlobAsyncClientBase#copyFromURLWithResponse(URL, Map, AccessTier, + * Code snippets for {@link BlobAsyncClientBase#copyFromUrlWithResponse(URL, Map, AccessTier, * ModifiedAccessConditions, BlobAccessConditions)} */ - public void copyFromURLWithResponseCodeSnippets() { + public void copyFromUrlWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.copyFromURLWithResponse#URL-Map-AccessTier-ModifiedAccessConditions-BlobAccessConditions + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.copyFromUrlWithResponse#URL-Map-AccessTier-ModifiedAccessConditions-BlobAccessConditions Map metadata = Collections.singletonMap("metadata", "value"); ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(7)); BlobAccessConditions blobAccessConditions = new BlobAccessConditions() .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)); - client.copyFromURLWithResponse(url, metadata, AccessTier.HOT, modifiedAccessConditions, blobAccessConditions) + client.copyFromUrlWithResponse(url, metadata, AccessTier.HOT, modifiedAccessConditions, blobAccessConditions) .subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); - // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.copyFromURLWithResponse#URL-Map-AccessTier-ModifiedAccessConditions-BlobAccessConditions + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.copyFromUrlWithResponse#URL-Map-AccessTier-ModifiedAccessConditions-BlobAccessConditions } /** @@ -324,21 +324,21 @@ public void getPropertiesWithResponseCodeSnippets() { } /** - * Code snippets for {@link BlobAsyncClientBase#setHTTPHeadersWithResponse(BlobHTTPHeaders, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClientBase#setHttpHeadersWithResponse(BlobHttpHeaders, BlobAccessConditions)} */ - public void setHTTPHeadersWithResponseCodeSnippets() { + public void setHttpHeadersWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions + // BEGIN: com.azure.storage.blob.specialized.BlobAsyncClientBase.setHttpHeadersWithResponse#BlobHttpHeaders-BlobAccessConditions BlobAccessConditions accessConditions = new BlobAccessConditions() .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)); - client.setHTTPHeadersWithResponse(new BlobHTTPHeaders() + client.setHttpHeadersWithResponse(new BlobHttpHeaders() .setBlobContentLanguage("en-US") .setBlobContentType("binary"), accessConditions).subscribe( response -> System.out.printf("Set HTTP headers completed with status %d%n", response.getStatusCode())); - // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions + // END: com.azure.storage.blob.specialized.BlobAsyncClientBase.setHttpHeadersWithResponse#BlobHttpHeaders-BlobAccessConditions } /** 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 84ceb5788492..5e67c53e6102 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 @@ -7,7 +7,7 @@ import com.azure.storage.blob.BlobProperties; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; import com.azure.storage.blob.models.LeaseAccessConditions; @@ -59,31 +59,31 @@ public void existsCodeSnippet() { } /** - * Code snippets for {@link BlobClientBase#startCopyFromURL(URL)} + * Code snippets for {@link BlobClientBase#startCopyFromUrl(URL)} */ - public void startCopyFromURL() { - // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.startCopyFromURL#URL - System.out.printf("Copy identifier: %s%n", client.startCopyFromURL(url)); - // END: com.azure.storage.blob.specialized.BlobClientBase.startCopyFromURL#URL + public void startCopyFromUrl() { + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.startCopyFromUrl#URL + System.out.printf("Copy identifier: %s%n", client.startCopyFromUrl(url)); + // END: com.azure.storage.blob.specialized.BlobClientBase.startCopyFromUrl#URL } /** - * Code snippets for {@link BlobClientBase#abortCopyFromURL(String)} + * Code snippets for {@link BlobClientBase#abortCopyFromUrl(String)} */ - public void abortCopyFromURL() { - // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.abortCopyFromURL#String - client.abortCopyFromURL(copyId); + public void abortCopyFromUrl() { + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.abortCopyFromUrl#String + client.abortCopyFromUrl(copyId); System.out.println("Aborted copy completed."); - // END: com.azure.storage.blob.specialized.BlobClientBase.abortCopyFromURL#String + // END: com.azure.storage.blob.specialized.BlobClientBase.abortCopyFromUrl#String } /** - * Code snippets for {@link BlobClientBase#copyFromURL(URL)} + * Code snippets for {@link BlobClientBase#copyFromUrl(URL)} */ - public void copyFromURL() { - // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.copyFromURL#URL - System.out.printf("Copy identifier: %s%n", client.copyFromURL(url)); - // END: com.azure.storage.blob.specialized.BlobClientBase.copyFromURL#URL + public void copyFromUrl() { + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.copyFromUrl#URL + System.out.printf("Copy identifier: %s%n", client.copyFromUrl(url)); + // END: com.azure.storage.blob.specialized.BlobClientBase.copyFromUrl#URL } /** @@ -138,15 +138,15 @@ public void getProperties() { } /** - * Code snippets for {@link BlobClientBase#setHTTPHeaders(BlobHTTPHeaders)} + * Code snippets for {@link BlobClientBase#setHttpHeaders(BlobHttpHeaders)} */ - public void setHTTPHeaders() { - // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.setHTTPHeaders#BlobHTTPHeaders - client.setHTTPHeaders(new BlobHTTPHeaders() + public void setHttpHeaders() { + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.setHttpHeaders#BlobHttpHeaders + client.setHttpHeaders(new BlobHttpHeaders() .setBlobContentLanguage("en-US") .setBlobContentType("binary")); System.out.println("Set HTTP headers completed"); - // END: com.azure.storage.blob.specialized.BlobClientBase.setHTTPHeaders#BlobHTTPHeaders + // END: com.azure.storage.blob.specialized.BlobClientBase.setHttpHeaders#BlobHttpHeaders } /** @@ -211,12 +211,12 @@ public void existsWithResponseCodeSnippet() { } /** - * Code snippets for {@link BlobClientBase#startCopyFromURLWithResponse(URL, Map, AccessTier, RehydratePriority, + * Code snippets for {@link BlobClientBase#startCopyFromUrlWithResponse(URL, Map, AccessTier, RehydratePriority, * ModifiedAccessConditions, BlobAccessConditions, Duration, Context)} */ - public void startCopyFromURLWithResponseCodeSnippets() { + public void startCopyFromUrlWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.startCopyFromURLWithResponse#URL-Map-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.startCopyFromUrlWithResponse#URL-Map-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions-Duration-Context Map metadata = Collections.singletonMap("metadata", "value"); ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(7)); @@ -224,32 +224,32 @@ public void startCopyFromURLWithResponseCodeSnippets() { new LeaseAccessConditions().setLeaseId(leaseId)); System.out.printf("Copy identifier: %s%n", - client.startCopyFromURLWithResponse(url, metadata, AccessTier.HOT, RehydratePriority.STANDARD, + client.startCopyFromUrlWithResponse(url, metadata, AccessTier.HOT, RehydratePriority.STANDARD, modifiedAccessConditions, blobAccessConditions, timeout, new Context(key2, value2))); - // END: com.azure.storage.blob.specialized.BlobClientBase.startCopyFromURLWithResponse#URL-Map-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + // END: com.azure.storage.blob.specialized.BlobClientBase.startCopyFromUrlWithResponse#URL-Map-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClientBase#abortCopyFromURLWithResponse(String, LeaseAccessConditions, Duration, Context)} + * Code snippets for {@link BlobClientBase#abortCopyFromUrlWithResponse(String, LeaseAccessConditions, Duration, Context)} */ - public void abortCopyFromURLWithResponseCodeSnippets() { + public void abortCopyFromUrlWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.abortCopyFromURLWithResponse#String-LeaseAccessConditions-Duration-Context + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.abortCopyFromUrlWithResponse#String-LeaseAccessConditions-Duration-Context LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().setLeaseId(leaseId); System.out.printf("Aborted copy completed with status %d%n", - client.abortCopyFromURLWithResponse(copyId, leaseAccessConditions, timeout, + client.abortCopyFromUrlWithResponse(copyId, leaseAccessConditions, timeout, new Context(key2, value2)).getStatusCode()); - // END: com.azure.storage.blob.specialized.BlobClientBase.abortCopyFromURLWithResponse#String-LeaseAccessConditions-Duration-Context + // END: com.azure.storage.blob.specialized.BlobClientBase.abortCopyFromUrlWithResponse#String-LeaseAccessConditions-Duration-Context } /** - * Code snippets for {@link BlobClientBase#copyFromURLWithResponse(URL, Map, AccessTier, ModifiedAccessConditions, + * Code snippets for {@link BlobClientBase#copyFromUrlWithResponse(URL, Map, AccessTier, ModifiedAccessConditions, * BlobAccessConditions, Duration, Context)} */ - public void copyFromURLWithResponseCodeSnippets() { + public void copyFromUrlWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.copyFromURLWithResponse#URL-Map-AccessTier-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.copyFromUrlWithResponse#URL-Map-AccessTier-ModifiedAccessConditions-BlobAccessConditions-Duration-Context Map metadata = Collections.singletonMap("metadata", "value"); ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(7)); @@ -257,10 +257,10 @@ public void copyFromURLWithResponseCodeSnippets() { new LeaseAccessConditions().setLeaseId(leaseId)); System.out.printf("Copy identifier: %s%n", - client.copyFromURLWithResponse(url, metadata, AccessTier.HOT, modifiedAccessConditions, + client.copyFromUrlWithResponse(url, metadata, AccessTier.HOT, modifiedAccessConditions, blobAccessConditions, timeout, new Context(key1, value1)).getValue()); - // END: com.azure.storage.blob.specialized.BlobClientBase.copyFromURLWithResponse#URL-Map-AccessTier-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + // END: com.azure.storage.blob.specialized.BlobClientBase.copyFromUrlWithResponse#URL-Map-AccessTier-ModifiedAccessConditions-BlobAccessConditions-Duration-Context } /** @@ -309,20 +309,20 @@ public void getPropertiesWithResponseCodeSnippets() { } /** - * Code snippets for {@link BlobClientBase#setHTTPHeadersWithResponse(BlobHTTPHeaders, BlobAccessConditions, Duration, + * Code snippets for {@link BlobClientBase#setHttpHeadersWithResponse(BlobHttpHeaders, BlobAccessConditions, Duration, * Context)} */ - public void setHTTPHeadersWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context + public void setHttpHeadersWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.specialized.BlobClientBase.setHttpHeadersWithResponse#BlobHttpHeaders-BlobAccessConditions-Duration-Context BlobAccessConditions accessConditions = new BlobAccessConditions() .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)); System.out.printf("Set HTTP headers completed with status %d%n", - client.setHTTPHeadersWithResponse(new BlobHTTPHeaders() + client.setHttpHeadersWithResponse(new BlobHttpHeaders() .setBlobContentLanguage("en-US") .setBlobContentType("binary"), accessConditions, timeout, new Context(key1, value1)) .getStatusCode()); - // END: com.azure.storage.blob.specialized.BlobClientBase.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context + // END: com.azure.storage.blob.specialized.BlobClientBase.setHttpHeadersWithResponse#BlobHttpHeaders-BlobAccessConditions-Duration-Context } /** diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlockBlobAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlockBlobAsyncClientJavaDocCodeSnippets.java index 99a74e83b6d9..9e20426b0519 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlockBlobAsyncClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlockBlobAsyncClientJavaDocCodeSnippets.java @@ -5,7 +5,7 @@ import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.BlockList; import com.azure.storage.blob.models.BlockListType; @@ -57,11 +57,11 @@ public void upload() { } /** - * Code snippet for {@link BlockBlobAsyncClient#uploadWithResponse(Flux, long, BlobHTTPHeaders, Map, AccessTier, BlobAccessConditions)} + * Code snippet for {@link BlockBlobAsyncClient#uploadWithResponse(Flux, long, BlobHttpHeaders, Map, AccessTier, BlobAccessConditions)} */ public void upload2() { // BEGIN: com.azure.storage.blob.specialized.BlockBlobAsyncClient.uploadWithResponse#Flux-long-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions - BlobHTTPHeaders headers = new BlobHTTPHeaders() + BlobHttpHeaders headers = new BlobHttpHeaders() .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) .setBlobContentLanguage("en-US") .setBlobContentType("binary"); @@ -102,30 +102,30 @@ public void stageBlock2() { } /** - * Code snippet for {@link BlockBlobAsyncClient#stageBlockFromURL(String, URL, BlobRange)} + * Code snippet for {@link BlockBlobAsyncClient#stageBlockFromUrl(String, URL, BlobRange)} */ - public void stageBlockFromURL() { - // BEGIN: com.azure.storage.blob.specialized.BlockBlobAsyncClient.stageBlockFromURL#String-URL-BlobRange - client.stageBlockFromURL(base64BlockID, sourceURL, new BlobRange(offset, count)) + public void stageBlockFromUrl() { + // BEGIN: com.azure.storage.blob.specialized.BlockBlobAsyncClient.stageBlockFromUrl#String-URL-BlobRange + client.stageBlockFromUrl(base64BlockID, sourceURL, new BlobRange(offset, count)) .subscribe( response -> System.out.println("Staging block completed"), error -> System.out.printf("Error when calling stage Block: %s", error)); - // END: com.azure.storage.blob.specialized.BlockBlobAsyncClient.stageBlockFromURL#String-URL-BlobRange + // END: com.azure.storage.blob.specialized.BlockBlobAsyncClient.stageBlockFromUrl#String-URL-BlobRange } /** - * Code snippet for {@link BlockBlobAsyncClient#stageBlockFromURLWithResponse(String, URL, BlobRange, byte[], LeaseAccessConditions, SourceModifiedAccessConditions)} + * Code snippet for {@link BlockBlobAsyncClient#stageBlockFromUrlWithResponse(String, URL, BlobRange, byte[], LeaseAccessConditions, SourceModifiedAccessConditions)} */ - public void stageBlockFromURL2() { - // BEGIN: com.azure.storage.blob.specialized.BlockBlobAsyncClient.stageBlockFromURLWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions + public void stageBlockFromUrl2() { + // BEGIN: com.azure.storage.blob.specialized.BlockBlobAsyncClient.stageBlockFromUrlWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().setLeaseId(leaseId); SourceModifiedAccessConditions sourceModifiedAccessConditions = new SourceModifiedAccessConditions() .setSourceIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - client.stageBlockFromURLWithResponse(base64BlockID, sourceURL, new BlobRange(offset, count), null, + client.stageBlockFromUrlWithResponse(base64BlockID, sourceURL, new BlobRange(offset, count), null, leaseAccessConditions, sourceModifiedAccessConditions).subscribe(response -> System.out.printf("Staging block from URL completed with status %d%n", response.getStatusCode())); - // END: com.azure.storage.blob.specialized.BlockBlobAsyncClient.stageBlockFromURLWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions + // END: com.azure.storage.blob.specialized.BlockBlobAsyncClient.stageBlockFromUrlWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions } /** @@ -172,11 +172,11 @@ public void commitBlockList() { } /** - * Code snippet for {@link BlockBlobAsyncClient#commitBlockListWithResponse(List, BlobHTTPHeaders, Map, AccessTier, BlobAccessConditions)} + * Code snippet for {@link BlockBlobAsyncClient#commitBlockListWithResponse(List, BlobHttpHeaders, Map, AccessTier, BlobAccessConditions)} */ public void commitBlockList2() { - // BEGIN: com.azure.storage.blob.specialized.BlockBlobAsyncClient.commitBlockListWithResponse#List-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions - BlobHTTPHeaders headers = new BlobHTTPHeaders() + // BEGIN: com.azure.storage.blob.specialized.BlockBlobAsyncClient.commitBlockListWithResponse#List-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions + BlobHttpHeaders headers = new BlobHttpHeaders() .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) .setBlobContentLanguage("en-US") .setBlobContentType("binary"); @@ -189,6 +189,6 @@ public void commitBlockList2() { client.commitBlockListWithResponse(Collections.singletonList(base64BlockID), headers, metadata, AccessTier.HOT, accessConditions).subscribe(response -> System.out.printf("Committing block list completed with status %d%n", response.getStatusCode())); - // END: com.azure.storage.blob.specialized.BlockBlobAsyncClient.commitBlockListWithResponse#List-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions + // END: com.azure.storage.blob.specialized.BlockBlobAsyncClient.commitBlockListWithResponse#List-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlockBlobClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlockBlobClientJavaDocCodeSnippets.java index 839d4e99c743..cba1d67f9b0d 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlockBlobClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/BlockBlobClientJavaDocCodeSnippets.java @@ -6,7 +6,7 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.BlockList; import com.azure.storage.blob.models.BlockListType; @@ -61,11 +61,11 @@ public void upload() throws IOException { } /** - * Code snippet for {@link BlockBlobClient#uploadWithResponse(InputStream, long, BlobHTTPHeaders, Map, AccessTier, BlobAccessConditions, Duration, Context)} + * Code snippet for {@link BlockBlobClient#uploadWithResponse(InputStream, long, BlobHttpHeaders, Map, AccessTier, BlobAccessConditions, Duration, Context)} */ public void upload2() { // BEGIN: com.azure.storage.blob.specialized.BlockBlobClient.uploadWithResponse#InputStream-long-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions-Duration-Context - BlobHTTPHeaders headers = new BlobHTTPHeaders() + BlobHttpHeaders headers = new BlobHttpHeaders() .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) .setBlobContentLanguage("en-US") .setBlobContentType("binary"); @@ -107,28 +107,28 @@ public void stageBlock2() { } /** - * Code snippet for {@link BlockBlobClient#stageBlockFromURL(String, URL, BlobRange)} + * Code snippet for {@link BlockBlobClient#stageBlockFromUrl(String, URL, BlobRange)} */ - public void stageBlockFromURL() { - // BEGIN: com.azure.storage.blob.specialized.BlockBlobClient.stageBlockFromURL#String-URL-BlobRange - client.stageBlockFromURL(base64BlockID, sourceURL, new BlobRange(offset, count)); - // END: com.azure.storage.blob.specialized.BlockBlobClient.stageBlockFromURL#String-URL-BlobRange + public void stageBlockFromUrl() { + // BEGIN: com.azure.storage.blob.specialized.BlockBlobClient.stageBlockFromUrl#String-URL-BlobRange + client.stageBlockFromUrl(base64BlockID, sourceURL, new BlobRange(offset, count)); + // END: com.azure.storage.blob.specialized.BlockBlobClient.stageBlockFromUrl#String-URL-BlobRange } /** - * Code snippet for {@link BlockBlobClient#stageBlockFromURLWithResponse(String, URL, BlobRange, byte[], LeaseAccessConditions, SourceModifiedAccessConditions, Duration, Context)} + * Code snippet for {@link BlockBlobClient#stageBlockFromUrlWithResponse(String, URL, BlobRange, byte[], LeaseAccessConditions, SourceModifiedAccessConditions, Duration, Context)} */ - public void stageBlockFromURL2() { - // BEGIN: com.azure.storage.blob.specialized.BlockBlobClient.stageBlockFromURLWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions-Duration-Context + public void stageBlockFromUrl2() { + // BEGIN: com.azure.storage.blob.specialized.BlockBlobClient.stageBlockFromUrlWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions-Duration-Context LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().setLeaseId(leaseId); SourceModifiedAccessConditions sourceModifiedAccessConditions = new SourceModifiedAccessConditions() .setSourceIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); Context context = new Context("key", "value"); System.out.printf("Staging block from URL completed with status %d%n", - client.stageBlockFromURLWithResponse(base64BlockID, sourceURL, new BlobRange(offset, count), null, + client.stageBlockFromUrlWithResponse(base64BlockID, sourceURL, new BlobRange(offset, count), null, leaseAccessConditions, sourceModifiedAccessConditions, timeout, context).getStatusCode()); - // END: com.azure.storage.blob.specialized.BlockBlobClient.stageBlockFromURLWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions-Duration-Context + // END: com.azure.storage.blob.specialized.BlockBlobClient.stageBlockFromUrlWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions-Duration-Context } /** @@ -174,11 +174,11 @@ public void commitBlockList() { } /** - * Code snippet for {@link BlockBlobClient#commitBlockListWithResponse(List, BlobHTTPHeaders, Map, AccessTier, BlobAccessConditions, Duration, Context)} + * Code snippet for {@link BlockBlobClient#commitBlockListWithResponse(List, BlobHttpHeaders, Map, AccessTier, BlobAccessConditions, Duration, Context)} */ public void commitBlockList2() { - // BEGIN: com.azure.storage.blob.specialized.BlockBlobClient.uploadFromFile#List-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions-Duration-Context - BlobHTTPHeaders headers = new BlobHTTPHeaders() + // BEGIN: com.azure.storage.blob.specialized.BlockBlobClient.uploadFromFile#List-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions-Duration-Context + BlobHttpHeaders headers = new BlobHttpHeaders() .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) .setBlobContentLanguage("en-US") .setBlobContentType("binary"); @@ -193,6 +193,6 @@ public void commitBlockList2() { System.out.printf("Committing block list completed with status %d%n", client.commitBlockListWithResponse(Collections.singletonList(base64BlockID), headers, metadata, AccessTier.HOT, accessConditions, timeout, context).getStatusCode()); - // END: com.azure.storage.blob.specialized.BlockBlobClient.uploadFromFile#List-BlobHTTPHeaders-Map-AccessTier-BlobAccessConditions-Duration-Context + // END: com.azure.storage.blob.specialized.BlockBlobClient.uploadFromFile#List-BlobHttpHeaders-Map-AccessTier-BlobAccessConditions-Duration-Context } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/PageBlobAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/PageBlobAsyncClientJavaDocCodeSnippets.java index 4b0749dc8370..ed0be7792d42 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/PageBlobAsyncClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/PageBlobAsyncClientJavaDocCodeSnippets.java @@ -4,7 +4,7 @@ package com.azure.storage.blob.specialized; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.CopyStatusType; import com.azure.storage.blob.models.LeaseAccessConditions; @@ -62,11 +62,11 @@ public void setCreateCodeSnippet() { } /** - * Code snippets for {@link PageBlobAsyncClient#createWithResponse(long, Long, BlobHTTPHeaders, Map, BlobAccessConditions)} + * Code snippets for {@link PageBlobAsyncClient#createWithResponse(long, Long, BlobHttpHeaders, Map, BlobAccessConditions)} */ public void createWithResponseCodeSnippet() { // BEGIN: com.azure.storage.blob.specialized.PageBlobAsyncClient.createWithResponse#long-Long-BlobHTTPHeaders-Map-BlobAccessConditions - BlobHTTPHeaders headers = new BlobHTTPHeaders() + BlobHttpHeaders headers = new BlobHttpHeaders() .setBlobContentLanguage("en-US") .setBlobContentType("binary"); BlobAccessConditions blobAccessConditions = new BlobAccessConditions().setLeaseAccessConditions( @@ -112,26 +112,26 @@ public void uploadPagesWithResponseCodeSnippet() { } /** - * Code snippets for {@link PageBlobAsyncClient#uploadPagesFromURL(PageRange, URL, Long)} + * Code snippets for {@link PageBlobAsyncClient#uploadPagesFromUrl(PageRange, URL, Long)} */ - public void uploadPagesFromURLCodeSnippet() { - // BEGIN: com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromURL#PageRange-URL-Long + public void uploadPagesFromUrlCodeSnippet() { + // BEGIN: com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromUrl#PageRange-URL-Long PageRange pageRange = new PageRange() .setStart(0) .setEnd(511); - client.uploadPagesFromURL(pageRange, url, sourceOffset) + client.uploadPagesFromUrl(pageRange, url, sourceOffset) .subscribe(response -> System.out.printf( "Uploaded page blob from URL with sequence number %s%n", response.getBlobSequenceNumber())); - // END: com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromURL#PageRange-URL-Long + // END: com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromUrl#PageRange-URL-Long } /** - * Code snippets for {@link PageBlobAsyncClient#uploadPagesFromURLWithResponse(PageRange, URL, Long, byte[], + * Code snippets for {@link PageBlobAsyncClient#uploadPagesFromUrlWithResponse(PageRange, URL, Long, byte[], * PageBlobAccessConditions, SourceModifiedAccessConditions)} */ - public void uploadPagesFromURLWithResponseCodeSnippet() { - // BEGIN: com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromURLWithResponse#PageRange-URL-Long-byte-PageBlobAccessConditions-SourceModifiedAccessConditions + public void uploadPagesFromUrlWithResponseCodeSnippet() { + // BEGIN: com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromUrlWithResponse#PageRange-URL-Long-byte-PageBlobAccessConditions-SourceModifiedAccessConditions PageRange pageRange = new PageRange() .setStart(0) .setEnd(511); @@ -142,11 +142,11 @@ public void uploadPagesFromURLWithResponseCodeSnippet() { SourceModifiedAccessConditions sourceAccessConditions = new SourceModifiedAccessConditions() .setSourceIfModifiedSince(OffsetDateTime.now()); - client.uploadPagesFromURLWithResponse(pageRange, url, sourceOffset, sourceContentMD5, pageBlobAccessConditions, + client.uploadPagesFromUrlWithResponse(pageRange, url, sourceOffset, sourceContentMD5, pageBlobAccessConditions, sourceAccessConditions) .subscribe(response -> System.out.printf( "Uploaded page blob from URL with sequence number %s%n", response.getValue().getBlobSequenceNumber())); - // END: com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromURLWithResponse#PageRange-URL-Long-byte-PageBlobAccessConditions-SourceModifiedAccessConditions + // END: com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromUrlWithResponse#PageRange-URL-Long-byte-PageBlobAccessConditions-SourceModifiedAccessConditions } /** diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/PageBlobClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/PageBlobClientJavaDocCodeSnippets.java index 0394b34bc2e7..0013fabd3922 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/PageBlobClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/specialized/PageBlobClientJavaDocCodeSnippets.java @@ -5,7 +5,7 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobHttpHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.CopyStatusType; import com.azure.storage.blob.models.LeaseAccessConditions; @@ -62,11 +62,11 @@ public void createCodeSnippet() { } /** - * Code snippets for {@link PageBlobClient#createWithResponse(long, Long, BlobHTTPHeaders, Map, BlobAccessConditions, Duration, Context)} + * Code snippets for {@link PageBlobClient#createWithResponse(long, Long, BlobHttpHeaders, Map, BlobAccessConditions, Duration, Context)} */ public void createWithResponseCodeSnippet() { // BEGIN: com.azure.storage.blob.specialized.PageBlobClient.createWithResponse#long-Long-BlobHTTPHeaders-Map-BlobAccessConditions-Duration-Context - BlobHTTPHeaders headers = new BlobHTTPHeaders() + BlobHttpHeaders headers = new BlobHttpHeaders() .setBlobContentLanguage("en-US") .setBlobContentType("binary"); BlobAccessConditions blobAccessConditions = new BlobAccessConditions().setLeaseAccessConditions( @@ -118,26 +118,26 @@ public void uploadPagesWithResponseCodeSnippet() { } /** - * Code snippets for {@link PageBlobClient#uploadPagesFromURL(PageRange, URL, Long)} + * Code snippets for {@link PageBlobClient#uploadPagesFromUrl(PageRange, URL, Long)} */ - public void uploadPagesFromURLCodeSnippet() { - // BEGIN: com.azure.storage.blob.specialized.PageBlobClient.uploadPagesFromURL#PageRange-URL-Long + public void uploadPagesFromUrlCodeSnippet() { + // BEGIN: com.azure.storage.blob.specialized.PageBlobClient.uploadPagesFromUrl#PageRange-URL-Long PageRange pageRange = new PageRange() .setStart(0) .setEnd(511); - PageBlobItem pageBlob = client.uploadPagesFromURL(pageRange, url, sourceOffset); + PageBlobItem pageBlob = client.uploadPagesFromUrl(pageRange, url, sourceOffset); System.out.printf("Uploaded page blob from URL with sequence number %s%n", pageBlob.getBlobSequenceNumber()); - // END: com.azure.storage.blob.specialized.PageBlobClient.uploadPagesFromURL#PageRange-URL-Long + // END: com.azure.storage.blob.specialized.PageBlobClient.uploadPagesFromUrl#PageRange-URL-Long } /** - * Code snippets for {@link PageBlobClient#uploadPagesFromURLWithResponse(PageRange, URL, Long, byte[], + * Code snippets for {@link PageBlobClient#uploadPagesFromUrlWithResponse(PageRange, URL, Long, byte[], * PageBlobAccessConditions, SourceModifiedAccessConditions, Duration, Context)} */ - public void uploadPagesFromURLWithResponseCodeSnippet() { - // BEGIN: com.azure.storage.blob.specialized.PageBlobClient.uploadPagesFromURLWithResponse#PageRange-URL-Long-byte-PageBlobAccessConditions-SourceModifiedAccessConditions-Duration-Context + public void uploadPagesFromUrlWithResponseCodeSnippet() { + // BEGIN: com.azure.storage.blob.specialized.PageBlobClient.uploadPagesFromUrlWithResponse#PageRange-URL-Long-byte-PageBlobAccessConditions-SourceModifiedAccessConditions-Duration-Context PageRange pageRange = new PageRange() .setStart(0) .setEnd(511); @@ -150,11 +150,11 @@ public void uploadPagesFromURLWithResponseCodeSnippet() { Context context = new Context(key, value); PageBlobItem pageBlob = client - .uploadPagesFromURLWithResponse(pageRange, url, sourceOffset, sourceContentMD5, pageBlobAccessConditions, + .uploadPagesFromUrlWithResponse(pageRange, url, sourceOffset, sourceContentMD5, pageBlobAccessConditions, sourceAccessConditions, timeout, context).getValue(); System.out.printf("Uploaded page blob from URL with sequence number %s%n", pageBlob.getBlobSequenceNumber()); - // END: com.azure.storage.blob.specialized.PageBlobClient.uploadPagesFromURLWithResponse#PageRange-URL-Long-byte-PageBlobAccessConditions-SourceModifiedAccessConditions-Duration-Context + // END: com.azure.storage.blob.specialized.PageBlobClient.uploadPagesFromUrlWithResponse#PageRange-URL-Long-byte-PageBlobAccessConditions-SourceModifiedAccessConditions-Duration-Context } /** 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 69e0f72ab08c..12d64c4bdeca 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 @@ -7,7 +7,7 @@ import com.azure.core.implementation.util.ImplUtils import com.azure.storage.blob.models.AccessTier import com.azure.storage.blob.models.ArchiveStatus import com.azure.storage.blob.models.BlobAccessConditions -import com.azure.storage.blob.models.BlobHTTPHeaders +import com.azure.storage.blob.models.BlobHttpHeaders import com.azure.storage.blob.models.BlobRange import com.azure.storage.blob.models.BlobType import com.azure.storage.blob.models.CopyStatusType @@ -385,7 +385,7 @@ class BlobAPITest extends APISpec { def "Set HTTP headers null"() { setup: - def response = bc.setHTTPHeadersWithResponse(null, null, null, null) + def response = bc.setHttpHeadersWithResponse(null, null, null, null) expect: response.getStatusCode() == 200 @@ -395,7 +395,7 @@ class BlobAPITest extends APISpec { def "Set HTTP headers min"() { setup: def properties = bc.getProperties() - def headers = new BlobHTTPHeaders() + def headers = new BlobHttpHeaders() .setBlobContentEncoding(properties.getContentEncoding()) .setBlobContentDisposition(properties.getContentDisposition()) .setBlobContentType("type") @@ -403,7 +403,7 @@ class BlobAPITest extends APISpec { .setBlobContentLanguage(properties.getContentLanguage()) .setBlobContentMD5(Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultData.array()))) - bc.setHTTPHeaders(headers) + bc.setHttpHeaders(headers) expect: bc.getProperties().getContentType() == "type" @@ -412,14 +412,14 @@ class BlobAPITest extends APISpec { @Unroll def "Set HTTP headers headers"() { setup: - def putHeaders = new BlobHTTPHeaders().setBlobCacheControl(cacheControl) + def putHeaders = new BlobHttpHeaders().setBlobCacheControl(cacheControl) .setBlobContentDisposition(contentDisposition) .setBlobContentEncoding(contentEncoding) .setBlobContentLanguage(contentLanguage) .setBlobContentMD5(contentMD5) .setBlobContentType(contentType) - bc.setHTTPHeaders(putHeaders) + bc.setHttpHeaders(putHeaders) expect: validateBlobProperties( @@ -447,7 +447,7 @@ class BlobAPITest extends APISpec { .setIfNoneMatch(noneMatch)) expect: - bc.setHTTPHeadersWithResponse(null, bac, null, null).getStatusCode() == 200 + bc.setHttpHeadersWithResponse(null, bac, null, null).getStatusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -473,7 +473,7 @@ class BlobAPITest extends APISpec { .setIfNoneMatch(noneMatch)) when: - bc.setHTTPHeadersWithResponse(null, bac, null, null) + bc.setHttpHeadersWithResponse(null, bac, null, null) then: thrown(StorageException) @@ -492,7 +492,7 @@ class BlobAPITest extends APISpec { bc = cc.getBlobClient(generateBlobName()).getBlockBlobClient() when: - bc.setHTTPHeaders(null) + bc.setHttpHeaders(null) then: thrown(StorageException) @@ -715,7 +715,7 @@ class BlobAPITest extends APISpec { setup: def copyDestBlob = cc.getBlobClient(generateBlobName()).getBlockBlobClient() def headers = - copyDestBlob.startCopyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, null, null, null).getHeaders() + copyDestBlob.startCopyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, null, null, null).getHeaders() when: while (copyDestBlob.getProperties().getCopyStatus() == CopyStatusType.PENDING) { @@ -734,7 +734,7 @@ class BlobAPITest extends APISpec { def "Copy min"() { expect: - bc.startCopyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, null, null, null).getStatusCode() == 202 + bc.startCopyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, null, null, null).getStatusCode() == 202 } @Unroll @@ -749,7 +749,7 @@ class BlobAPITest extends APISpec { metadata.put(key2, value2) } - def status = bu2.startCopyFromURLWithResponse(new URL(bc.getBlobUrl()), metadata, null, null, null, null, null, null) + def status = bu2.startCopyFromUrlWithResponse(new URL(bc.getBlobUrl()), metadata, null, null, null, null, null, null) .getHeaders().getValue("x-ms-copy-status") def start = OffsetDateTime.now() @@ -783,7 +783,7 @@ class BlobAPITest extends APISpec { .setIfNoneMatch(noneMatch) expect: - copyDestBlob.startCopyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, null, mac, null, null, null).getStatusCode() == 202 + copyDestBlob.startCopyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, null, mac, null, null, null).getStatusCode() == 202 where: modified | unmodified | match | noneMatch @@ -806,7 +806,7 @@ class BlobAPITest extends APISpec { .setIfNoneMatch(noneMatch) when: - bu2.startCopyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, null, mac, null, null, null) + bu2.startCopyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, null, mac, null, null, null) then: thrown(StorageException) @@ -836,7 +836,7 @@ class BlobAPITest extends APISpec { expect: - bu2.startCopyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, bac, null, null).getStatusCode() == 202 + bu2.startCopyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, bac, null, null).getStatusCode() == 202 where: modified | unmodified | match | noneMatch | leaseID @@ -864,7 +864,7 @@ class BlobAPITest extends APISpec { .setIfNoneMatch(noneMatch)) when: - bu2.startCopyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, bac, null, null) + bu2.startCopyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, bac, null, null) then: thrown(StorageException) @@ -895,9 +895,9 @@ class BlobAPITest extends APISpec { def leaseID = setupBlobLeaseCondition(bu2, receivedLeaseID) when: - def copyID = bu2.startCopyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, + def copyID = bu2.startCopyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, new BlobAccessConditions().setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)), null, null).getValue() - bu2.abortCopyFromURLWithResponse(copyID, new LeaseAccessConditions().setLeaseId(garbageLeaseID), null, null) + bu2.abortCopyFromUrlWithResponse(copyID, new LeaseAccessConditions().setLeaseId(garbageLeaseID), null, null) then: def e = thrown(StorageException) @@ -921,8 +921,8 @@ class BlobAPITest extends APISpec { def bu2 = cu2.getBlobClient(generateBlobName()) when: - def copyID = bu2.startCopyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, null, null, null).getValue() - def response = bu2.abortCopyFromURLWithResponse(copyID, null, null, null) + def copyID = bu2.startCopyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, null, null, null).getValue() + def response = bu2.abortCopyFromUrlWithResponse(copyID, null, null, null) def headers = response.getHeaders() then: @@ -948,10 +948,10 @@ class BlobAPITest extends APISpec { def bu2 = cu2.getBlobClient(generateBlobName()) when: - def copyID = bu2.startCopyFromURL(new URL(bc.getBlobUrl())) + def copyID = bu2.startCopyFromUrl(new URL(bc.getBlobUrl())) then: - bu2.abortCopyFromURLWithResponse(copyID, null, null, null).getStatusCode() == 204 + bu2.abortCopyFromUrlWithResponse(copyID, null, null, null).getStatusCode() == 204 } def "Abort copy lease"() { @@ -971,11 +971,11 @@ class BlobAPITest extends APISpec { when: def copyID = - bu2.startCopyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, + bu2.startCopyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, new BlobAccessConditions().setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)), null, null).getValue() then: - bu2.abortCopyFromURLWithResponse(copyID, new LeaseAccessConditions().setLeaseId(leaseID), null, null).getStatusCode() == 204 + bu2.abortCopyFromUrlWithResponse(copyID, new LeaseAccessConditions().setLeaseId(leaseID), null, null).getStatusCode() == 204 // Normal test cleanup will not clean up containers in the alternate account. cu2.delete() } @@ -985,7 +985,7 @@ class BlobAPITest extends APISpec { bc = cc.getBlobClient(generateBlobName()).getBlockBlobClient() when: - bc.startCopyFromURL(new URL("http://www.error.com")) + bc.startCopyFromUrl(new URL("http://www.error.com")) then: thrown(StorageException) @@ -996,7 +996,7 @@ class BlobAPITest extends APISpec { bc = cc.getBlobClient(generateBlobName()).getBlockBlobClient() when: - bc.abortCopyFromURL("id") + bc.abortCopyFromUrl("id") then: thrown(StorageException) @@ -1009,7 +1009,7 @@ class BlobAPITest extends APISpec { def bu2 = cc.getBlobClient(generateBlobName()).getBlockBlobClient() when: - def headers = bu2.copyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, null, null).getHeaders() + def headers = bu2.copyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, null, null).getHeaders() then: headers.getValue("x-ms-copy-status") == SyncCopyStatusType.SUCCESS.toString() @@ -1023,7 +1023,7 @@ class BlobAPITest extends APISpec { def bu2 = cc.getBlobClient(generateBlobName()).getBlockBlobClient() expect: - bu2.copyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, null, null).getStatusCode() == 202 + bu2.copyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, null, null, null, null).getStatusCode() == 202 } @Unroll @@ -1040,7 +1040,7 @@ class BlobAPITest extends APISpec { } when: - bu2.copyFromURLWithResponse(new URL(bc.getBlobUrl()), metadata, null, null, null, null, null) + bu2.copyFromUrlWithResponse(new URL(bc.getBlobUrl()), metadata, null, null, null, null, null) then: bu2.getProperties().getMetadata() == metadata @@ -1064,7 +1064,7 @@ class BlobAPITest extends APISpec { .setIfNoneMatch(noneMatch) expect: - bu2.copyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, mac, null, null, null).getStatusCode() == 202 + bu2.copyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, mac, null, null, null).getStatusCode() == 202 where: modified | unmodified | match | noneMatch @@ -1088,7 +1088,7 @@ class BlobAPITest extends APISpec { .setIfNoneMatch(noneMatch) when: - bu2.copyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, mac, null, null, null) + bu2.copyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, mac, null, null, null) then: thrown(StorageException) @@ -1118,7 +1118,7 @@ class BlobAPITest extends APISpec { .setIfNoneMatch(noneMatch)) expect: - bu2.copyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, null, bac, null, null).getStatusCode() == 202 + bu2.copyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, null, bac, null, null).getStatusCode() == 202 where: modified | unmodified | match | noneMatch | leaseID @@ -1147,7 +1147,7 @@ class BlobAPITest extends APISpec { .setIfNoneMatch(noneMatch)) when: - bu2.copyFromURLWithResponse(new URL(bc.getBlobUrl()), null, null, null, bac, null, null) + bu2.copyFromUrlWithResponse(new URL(bc.getBlobUrl()), null, null, null, bac, null, null) then: thrown(StorageException) @@ -1166,7 +1166,7 @@ class BlobAPITest extends APISpec { def bu2 = cc.getBlobClient(generateBlobName()).getBlockBlobClient() when: - bu2.copyFromURL(new URL(bc.getBlobUrl())) + bu2.copyFromUrl(new URL(bc.getBlobUrl())) then: thrown(StorageException) @@ -1461,7 +1461,7 @@ class BlobAPITest extends APISpec { .setCanonicalName(bc.getBlobUrl().toString(), primaryCredential.getAccountName()) .generateSasQueryParameters(primaryCredential) .encode() - bcCopy.copyFromURLWithResponse(new URL(bc.getBlobUrl().toString() + "?" + sas), null, tier2, null, null, null, null) + 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 69d90c0120ef..3944fbff976f 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 @@ -99,7 +99,7 @@ class CPKTest extends APISpec { .generateSasQueryParameters(primaryCredential) .encode() - def response = cpkBlockBlob.stageBlockFromURLWithResponse(getBlockID(), new URL(sourceBlob.getBlobUrl().toString() + "?" + sas), + def response = cpkBlockBlob.stageBlockFromUrlWithResponse(getBlockID(), new URL(sourceBlob.getBlobUrl().toString() + "?" + sas), null, null, null, null, null, null) then: @@ -154,7 +154,7 @@ class CPKTest extends APISpec { .generateSasQueryParameters(primaryCredential) .encode() - def response = cpkPageBlob.uploadPagesFromURLWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), + def response = cpkPageBlob.uploadPagesFromUrlWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), 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/ContainerAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy index 14eb0b00c1fd..bb872de16599 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy @@ -619,7 +619,7 @@ class ContainerAPITest extends APISpec { def copyBlob = cc.getBlobClient(copyName).getPageBlobClient() - copyBlob.startCopyFromURL(new URL(normal.getBlobUrl())) + copyBlob.startCopyFromUrl(new URL(normal.getBlobUrl())) def start = OffsetDateTime.now() def status = CopyStatusType.PENDING while (status != CopyStatusType.SUCCESS) { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RequestRetryTestFactory.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RequestRetryTestFactory.java index 88495a5ac477..58eb7d5d2d35 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RequestRetryTestFactory.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RequestRetryTestFactory.java @@ -216,7 +216,7 @@ public Mono send(HttpRequest request) { UrlBuilder builder = UrlBuilder.parse(request.getUrl()); builder.setQueryParameter(RETRY_TEST_QUERY_PARAM, "testquery"); try { - request.setUrl(builder.toURL()); + request.setUrl(builder.toUrl()); } catch (MalformedURLException e) { throw new IllegalArgumentException("The URL has been mangled"); } 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 ad400b36046f..19b7da8dc0e7 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 @@ -1129,7 +1129,7 @@ class SASTest extends APISpec { parts.setSasQueryParameters(sasValues.generateSasQueryParameters(primaryCredential)) when: - def splitParts = parts.toURL().toString().split("\\?") + def splitParts = parts.toUrl().toString().split("\\?") then: splitParts.size() == 2 // Ensure that there is only one question mark even when sas and snapshot are present diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAPITest.groovy index 31e1c30fdbff..298be67e5988 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAPITest.groovy @@ -9,7 +9,7 @@ import com.azure.storage.blob.APISpec import com.azure.storage.blob.models.AppendBlobAccessConditions import com.azure.storage.blob.models.AppendPositionAccessConditions import com.azure.storage.blob.models.BlobAccessConditions -import com.azure.storage.blob.models.BlobHTTPHeaders +import com.azure.storage.blob.models.BlobHttpHeaders import com.azure.storage.blob.models.BlobRange import com.azure.storage.blob.models.LeaseAccessConditions @@ -59,7 +59,7 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Create headers"() { setup: - def headers = new BlobHTTPHeaders().setBlobCacheControl(cacheControl) + def headers = new BlobHttpHeaders().setBlobCacheControl(cacheControl) .setBlobContentDisposition(contentDisposition) .setBlobContentEncoding(contentEncoding) .setBlobContentLanguage(contentLanguage) 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 f506628933aa..554119de2d49 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 @@ -17,7 +17,7 @@ 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 -import com.azure.storage.blob.models.BlobHTTPHeaders +import com.azure.storage.blob.models.BlobHttpHeaders import com.azure.storage.blob.models.BlobRange import com.azure.storage.blob.models.BlockListType import com.azure.storage.blob.models.LeaseAccessConditions @@ -151,7 +151,7 @@ class BlockBlobAPITest extends APISpec { def blockID = getBlockID() when: - def headers = bu2.stageBlockFromURLWithResponse(blockID, new URL(bc.getBlobUrl()), null, null, null, null, null, null).getHeaders() + def headers = bu2.stageBlockFromUrlWithResponse(blockID, new URL(bc.getBlobUrl()), null, null, null, null, null, null).getHeaders() then: headers.getValue("x-ms-request-id") != null @@ -180,14 +180,14 @@ class BlockBlobAPITest extends APISpec { def blockID = getBlockID() expect: - bu2.stageBlockFromURLWithResponse(blockID, new URL(bc.getBlobUrl()), null, null, null, null, null, null).getStatusCode() == 201 + bu2.stageBlockFromUrlWithResponse(blockID, new URL(bc.getBlobUrl()), null, null, null, null, null, null).getStatusCode() == 201 } @Unroll def "Stage block from URL IA"() { when: def blockID = (getBlockId) ? getBlockID() : null - bc.stageBlockFromURL(blockID, sourceURL, null) + bc.stageBlockFromUrl(blockID, sourceURL, null) then: thrown(StorageException) @@ -204,7 +204,7 @@ class BlockBlobAPITest extends APISpec { def destURL = cc.getBlobClient(generateBlobName()).getBlockBlobClient() when: - destURL.stageBlockFromURL(getBlockID(), new URL(bc.getBlobUrl()), new BlobRange(2, 3)) + destURL.stageBlockFromUrl(getBlockID(), new URL(bc.getBlobUrl()), new BlobRange(2, 3)) def blockList = destURL.listBlocks(BlockListType.UNCOMMITTED) then: @@ -218,7 +218,7 @@ class BlockBlobAPITest extends APISpec { def destURL = cc.getBlobClient(generateBlobName()).getBlockBlobClient() when: - destURL.stageBlockFromURLWithResponse(getBlockID(), new URL(bc.getBlobUrl()), null, + destURL.stageBlockFromUrlWithResponse(getBlockID(), new URL(bc.getBlobUrl()), null, MessageDigest.getInstance("MD5").digest(defaultData.array()), null, null, null, null) then: @@ -231,7 +231,7 @@ class BlockBlobAPITest extends APISpec { def destURL = cc.getBlobClient(generateBlobName()).getBlockBlobClient() when: - destURL.stageBlockFromURLWithResponse(getBlockID(), new URL(bc.getBlobUrl()), null, "garbage".getBytes(), + destURL.stageBlockFromUrlWithResponse(getBlockID(), new URL(bc.getBlobUrl()), null, "garbage".getBytes(), null, null, null, null) then: @@ -244,7 +244,7 @@ class BlockBlobAPITest extends APISpec { def lease = new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, receivedLeaseID)) when: - bc.stageBlockFromURLWithResponse(getBlockID(), new URL(bc.getBlobUrl()), null, null, lease, null, null, null) + bc.stageBlockFromUrlWithResponse(getBlockID(), new URL(bc.getBlobUrl()), null, null, lease, null, null, null) then: notThrown(StorageException) @@ -256,7 +256,7 @@ class BlockBlobAPITest extends APISpec { def lease = new LeaseAccessConditions().setLeaseId("garbage") when: - bc.stageBlockFromURLWithResponse(getBlockID(), new URL(bc.getBlobUrl()), null, null, lease, null, null, null) + bc.stageBlockFromUrlWithResponse(getBlockID(), new URL(bc.getBlobUrl()), null, null, lease, null, null, null) then: thrown(StorageException) @@ -269,7 +269,7 @@ class BlockBlobAPITest extends APISpec { .getBlockBlobClient() when: - bc.stageBlockFromURL(getBlockID(), new URL(bc.getBlobUrl()), null) + bc.stageBlockFromUrl(getBlockID(), new URL(bc.getBlobUrl()), null) then: thrown(StorageException) @@ -292,7 +292,7 @@ class BlockBlobAPITest extends APISpec { .setSourceIfNoneMatch(sourceIfNoneMatch) expect: - bc.stageBlockFromURLWithResponse(blockID, new URL(sourceURL.getBlobUrl()), null, null, null, smac, null, null).getStatusCode() == 201 + bc.stageBlockFromUrlWithResponse(blockID, new URL(sourceURL.getBlobUrl()), null, null, null, smac, null, null).getStatusCode() == 201 where: sourceIfModifiedSince | sourceIfUnmodifiedSince | sourceIfMatch | sourceIfNoneMatch @@ -319,7 +319,7 @@ class BlockBlobAPITest extends APISpec { .setSourceIfNoneMatch(setupBlobMatchCondition(sourceURL, sourceIfNoneMatch)) when: - bc.stageBlockFromURLWithResponse(blockID, new URL(sourceURL.getBlobUrl()), null, null, null, smac, null, null).getStatusCode() == 201 + bc.stageBlockFromUrlWithResponse(blockID, new URL(sourceURL.getBlobUrl()), null, null, null, smac, null, null).getStatusCode() == 201 then: thrown(StorageException) @@ -370,7 +370,7 @@ class BlockBlobAPITest extends APISpec { def blockID = getBlockID() bc.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) def ids = [ blockID ] as List - def headers = new BlobHTTPHeaders().setBlobCacheControl(cacheControl) + def headers = new BlobHttpHeaders().setBlobCacheControl(cacheControl) .setBlobContentDisposition(contentDisposition) .setBlobContentEncoding(contentEncoding) .setBlobContentLanguage(contentLanguage) @@ -669,7 +669,7 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Upload headers"() { setup: - def headers = new BlobHTTPHeaders().setBlobCacheControl(cacheControl) + def headers = new BlobHttpHeaders().setBlobCacheControl(cacheControl) .setBlobContentDisposition(contentDisposition) .setBlobContentEncoding(contentEncoding) .setBlobContentLanguage(contentLanguage) @@ -904,7 +904,7 @@ class BlockBlobAPITest extends APISpec { when: ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions() .setBlockSize(10) - blobac.uploadWithResponse(defaultFlux, parallelTransferOptions, new BlobHTTPHeaders().setBlobCacheControl(cacheControl) + blobac.uploadWithResponse(defaultFlux, parallelTransferOptions, new BlobHttpHeaders().setBlobCacheControl(cacheControl) .setBlobContentDisposition(contentDisposition) .setBlobContentEncoding(contentEncoding) .setBlobContentLanguage(contentLanguage) 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 047d236d35be..ddefc604464a 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 @@ -641,7 +641,7 @@ class HelperTest extends APISpec { parts.setSasQueryParameters(sasValues.generateSasQueryParameters(primaryCredential)) when: - String[] splitParts = parts.toURL().toString().split("\\?") + String[] splitParts = parts.toUrl().toString().split("\\?") then: splitParts.size() == 2 // Ensure that there is only one question mark even when sas and snapshot are present diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAPITest.groovy index a3b43432d56d..379446042372 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAPITest.groovy @@ -6,7 +6,7 @@ package com.azure.storage.blob.specialized import com.azure.core.exception.UnexpectedLengthException import com.azure.storage.blob.APISpec import com.azure.storage.blob.models.BlobAccessConditions -import com.azure.storage.blob.models.BlobHTTPHeaders +import com.azure.storage.blob.models.BlobHttpHeaders import com.azure.storage.blob.models.BlobRange import com.azure.storage.blob.models.CopyStatusType import com.azure.storage.blob.models.LeaseAccessConditions @@ -66,7 +66,7 @@ class PageBlobAPITest extends APISpec { @Unroll def "Create headers"() { setup: - def headers = new BlobHTTPHeaders().setBlobCacheControl(cacheControl) + def headers = new BlobHttpHeaders().setBlobCacheControl(cacheControl) .setBlobContentDisposition(contentDisposition) .setBlobContentEncoding(contentEncoding) .setBlobContentLanguage(contentLanguage) @@ -303,7 +303,7 @@ class PageBlobAPITest extends APISpec { def pageRange = new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1) when: - def response = bc.uploadPagesFromURLWithResponse(pageRange, new URL(destURL.getBlobUrl()), null, null, null, null, null, null) + def response = bc.uploadPagesFromUrlWithResponse(pageRange, new URL(destURL.getBlobUrl()), null, null, null, null, null, null) then: response.getStatusCode() == 201 @@ -325,7 +325,7 @@ class PageBlobAPITest extends APISpec { destURL.create(PageBlobClient.PAGE_BYTES * 2) when: - destURL.uploadPagesFromURL(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES * 2 - 1), + destURL.uploadPagesFromUrl(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES * 2 - 1), new URL(sourceURL.getBlobUrl()), PageBlobClient.PAGE_BYTES * 2) then: @@ -336,7 +336,7 @@ class PageBlobAPITest extends APISpec { def "Upload page from URL IA"() { when: - bc.uploadPagesFromURL(null, new URL(bc.getBlobUrl()), (Long) PageBlobClient.PAGE_BYTES) + bc.uploadPagesFromUrl(null, new URL(bc.getBlobUrl()), (Long) PageBlobClient.PAGE_BYTES) then: thrown(IllegalArgumentException) @@ -352,7 +352,7 @@ class PageBlobAPITest extends APISpec { bc.uploadPages(pageRange, new ByteArrayInputStream(data)) when: - destURL.uploadPagesFromURLWithResponse(pageRange, new URL(bc.getBlobUrl()), null, MessageDigest.getInstance("MD5").digest(data), + destURL.uploadPagesFromUrlWithResponse(pageRange, new URL(bc.getBlobUrl()), null, MessageDigest.getInstance("MD5").digest(data), null, null, null, null) then: @@ -368,7 +368,7 @@ class PageBlobAPITest extends APISpec { bc.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) when: - destURL.uploadPagesFromURLWithResponse(pageRange, new URL(bc.getBlobUrl()), null, + destURL.uploadPagesFromUrlWithResponse(pageRange, new URL(bc.getBlobUrl()), null, MessageDigest.getInstance("MD5").digest("garbage".getBytes()), null, null, null, null) then: @@ -397,7 +397,7 @@ class PageBlobAPITest extends APISpec { .setIfSequenceNumberEqualTo(sequenceNumberEqual)) expect: - bc.uploadPagesFromURLWithResponse(pageRange, new URL(sourceURL.getBlobUrl()), null, null, pac, null, null, null).getStatusCode() == 201 + bc.uploadPagesFromUrlWithResponse(pageRange, new URL(sourceURL.getBlobUrl()), null, null, pac, null, null, null).getStatusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | sequenceNumberLT | sequenceNumberLTE | sequenceNumberEqual @@ -436,7 +436,7 @@ class PageBlobAPITest extends APISpec { .setIfSequenceNumberEqualTo(sequenceNumberEqual)) when: - bc.uploadPagesFromURLWithResponse(pageRange, new URL(sourceURL.getBlobUrl()), null, null, pac, null, null, null) + bc.uploadPagesFromUrlWithResponse(pageRange, new URL(sourceURL.getBlobUrl()), null, null, pac, null, null, null) then: thrown(StorageException) @@ -470,7 +470,7 @@ class PageBlobAPITest extends APISpec { .setSourceIfNoneMatch(sourceIfNoneMatch) expect: - bc.uploadPagesFromURLWithResponse(pageRange, new URL(sourceURL.getBlobUrl()), null, null, null, smac, null, null).getStatusCode() == 201 + bc.uploadPagesFromUrlWithResponse(pageRange, new URL(sourceURL.getBlobUrl()), null, null, null, smac, null, null).getStatusCode() == 201 where: sourceIfModifiedSince | sourceIfUnmodifiedSince | sourceIfMatch | sourceIfNoneMatch @@ -497,7 +497,7 @@ class PageBlobAPITest extends APISpec { .setSourceIfNoneMatch(setupBlobMatchCondition(sourceURL, sourceIfNoneMatch)) when: - bc.uploadPagesFromURLWithResponse(pageRange, new URL(sourceURL.getBlobUrl()), null, null, null, smac, null, null) + bc.uploadPagesFromUrlWithResponse(pageRange, new URL(sourceURL.getBlobUrl()), null, null, null, smac, null, null) then: thrown(StorageException) diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/Utility.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/Utility.java index 3b0a95675731..29148a7bf88e 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/Utility.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/Utility.java @@ -447,7 +447,7 @@ public static URL appendToURLPath(String baseURL, String name) { builder.setPath(builder.getPath() + name); try { - return builder.toURL(); + return builder.toUrl(); } catch (MalformedURLException ex) { throw new IllegalArgumentException(ex); } @@ -471,7 +471,7 @@ public static URL stripLastPathSegment(URL baseURL) { builder.setPath(builder.getPath().substring(0, builder.getPath().lastIndexOf("/"))); try { - return builder.toURL(); + return builder.toUrl(); } catch (MalformedURLException ex) { throw new IllegalArgumentException(ex); } diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java index 5aabdfd7e612..23d1bfff66b7 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java @@ -101,7 +101,7 @@ stream, the buffers that were emitted will have already been consumed (their pos UrlBuilder builder = UrlBuilder.parse(context.getHttpRequest().getUrl()); builder.setHost(this.requestRetryOptions.secondaryHost()); try { - context.getHttpRequest().setUrl(builder.toURL()); + context.getHttpRequest().setUrl(builder.toUrl()); } catch (MalformedURLException e) { return Mono.error(e); } 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 index 2988a14cbd4b..ccb93bb444de 100644 --- 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 @@ -13,19 +13,19 @@ /** * Code snippets for {@link SasTokenCredential}. */ -public final class SASTokenCredentialJavaDocCodeSnippets { +public final class SasTokenCredentialJavaDocCodeSnippets { private final URL url = new URL("https://www.example.com?queryString"); /** * @throws MalformedURLException ignored */ - public SASTokenCredentialJavaDocCodeSnippets() throws MalformedURLException { + public SasTokenCredentialJavaDocCodeSnippets() throws MalformedURLException { } /** * Code sample for {@link SasTokenCredential#fromSasTokenString(String)}. */ - public void fromSASTokenString() { + public void fromSasTokenString() { String preformattedSASToken = "sasToken"; // BEGIN: com.azure.storage.common.credentials.SasTokenCredential.fromSasTokenString#String SasTokenCredential credential = SasTokenCredential.fromSasTokenString(preformattedSASToken); diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java index 9a69e2c2a806..fa9d1acbfee3 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java @@ -24,7 +24,7 @@ import com.azure.storage.file.models.DirectoryInfo; import com.azure.storage.file.models.DirectoryProperties; import com.azure.storage.file.models.DirectorySetMetadataInfo; -import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.FileHttpHeaders; import com.azure.storage.file.models.FileReference; import com.azure.storage.file.models.HandleItem; import com.azure.storage.file.models.StorageException; @@ -693,13 +693,13 @@ public Mono createFile(String fileName, long maxSize) { * is an invalid resource name. */ public Mono> createFileWithResponse(String fileName, long maxSize, - FileHTTPHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, + FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map metadata) { return withContext(context -> createFileWithResponse(fileName, maxSize, httpHeaders, smbProperties, filePermission, metadata, context)); } - Mono> createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, + Mono> createFileWithResponse(String fileName, long maxSize, FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map metadata, Context context) { FileAsyncClient fileAsyncClient = getFileClient(fileName); return postProcessResponse(fileAsyncClient diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClient.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClient.java index 0594a4acd440..7dd9c5b671cb 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClient.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/DirectoryClient.java @@ -13,7 +13,7 @@ import com.azure.storage.file.models.DirectoryInfo; import com.azure.storage.file.models.DirectoryProperties; import com.azure.storage.file.models.DirectorySetMetadataInfo; -import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.FileHttpHeaders; import com.azure.storage.file.models.FileInfo; import com.azure.storage.file.models.FileReference; import com.azure.storage.file.models.HandleItem; @@ -585,7 +585,7 @@ public FileClient createFile(String fileName, long maxSize) { * is an invalid resource name. * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public Response createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, + public Response createFileWithResponse(String fileName, long maxSize, FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map metadata, Duration timeout, Context context) { FileClient fileClient = getFileClient(fileName); 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 6ada93636d9f..e45ed0473194 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 @@ -22,20 +22,20 @@ import com.azure.storage.file.implementation.AzureFileStorageImpl; import com.azure.storage.file.implementation.models.FileGetPropertiesHeaders; import com.azure.storage.file.implementation.models.FileRangeWriteType; -import com.azure.storage.file.implementation.models.FileUploadRangeFromURLHeaders; +import com.azure.storage.file.implementation.models.FileUploadRangeFromUrlHeaders; import com.azure.storage.file.implementation.models.FileUploadRangeHeaders; import com.azure.storage.file.implementation.models.FilesCreateResponse; import com.azure.storage.file.implementation.models.FilesDownloadResponse; import com.azure.storage.file.implementation.models.FilesGetPropertiesResponse; -import com.azure.storage.file.implementation.models.FilesSetHTTPHeadersResponse; +import com.azure.storage.file.implementation.models.FilesSetHttpHeadersResponse; import com.azure.storage.file.implementation.models.FilesSetMetadataResponse; import com.azure.storage.file.implementation.models.FilesStartCopyResponse; -import com.azure.storage.file.implementation.models.FilesUploadRangeFromURLResponse; +import com.azure.storage.file.implementation.models.FilesUploadRangeFromUrlResponse; import com.azure.storage.file.implementation.models.FilesUploadRangeResponse; import com.azure.storage.file.models.CopyStatusType; import com.azure.storage.file.models.FileCopyInfo; import com.azure.storage.file.models.FileDownloadInfo; -import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.FileHttpHeaders; import com.azure.storage.file.models.FileInfo; import com.azure.storage.file.models.FileMetadataInfo; import com.azure.storage.file.models.FileProperties; @@ -169,13 +169,13 @@ public Mono create(long maxSize) { * @throws StorageException If the directory has already existed, the parent directory does not exist or directory * is an invalid resource name. */ - public Mono> createWithResponse(long maxSize, FileHTTPHeaders httpHeaders, + public Mono> createWithResponse(long maxSize, FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map metadata) { return withContext(context -> createWithResponse(maxSize, httpHeaders, smbProperties, filePermission, metadata, context)); } - Mono> createWithResponse(long maxSize, FileHTTPHeaders httpHeaders, + Mono> createWithResponse(long maxSize, FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map metadata, Context context) { smbProperties = smbProperties == null ? new FileSmbProperties() : smbProperties; @@ -552,8 +552,8 @@ Mono> getPropertiesWithResponse(Context context) { * @return The {@link FileInfo file info} * @throws IllegalArgumentException thrown if parameters fail the validation. */ - public Mono setProperties(long newFileSize, FileHTTPHeaders httpHeaders, FileSmbProperties smbProperties, - String filePermission) { + public Mono setProperties(long newFileSize, FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, + String filePermission) { return setPropertiesWithResponse(newFileSize, httpHeaders, smbProperties, filePermission) .flatMap(FluxUtil::toMono); } @@ -585,13 +585,13 @@ public Mono setProperties(long newFileSize, FileHTTPHeaders httpHeader * @return Response containing the {@link FileInfo file info} and response status code. * @throws IllegalArgumentException thrown if parameters fail the validation. */ - public Mono> setPropertiesWithResponse(long newFileSize, FileHTTPHeaders httpHeaders, + public Mono> setPropertiesWithResponse(long newFileSize, FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission) { return withContext(context -> setPropertiesWithResponse(newFileSize, httpHeaders, smbProperties, filePermission, context)); } - Mono> setPropertiesWithResponse(long newFileSize, FileHTTPHeaders httpHeaders, + Mono> setPropertiesWithResponse(long newFileSize, FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Context context) { smbProperties = smbProperties == null ? new FileSmbProperties() : smbProperties; @@ -607,7 +607,7 @@ Mono> setPropertiesWithResponse(long newFileSize, FileHTTPHea String fileLastWriteTime = smbProperties.setFileLastWriteTime(FileConstants.PRESERVE); return postProcessResponse(azureFileStorageClient.files() - .setHTTPHeadersWithRestResponseAsync(shareName, filePath, fileAttributes, fileCreationTime, + .setHttpHeadersWithRestResponseAsync(shareName, filePath, fileAttributes, fileCreationTime, fileLastWriteTime, null, newFileSize, filePermission, filePermissionKey, httpHeaders, context)) .map(this::setPropertiesResponse); } @@ -840,7 +840,7 @@ Mono> uploadRangeFromUrlWithResponse(long l FileRange sourceRange = new FileRange(sourceOffset, sourceOffset + length - 1); return postProcessResponse(azureFileStorageClient.files() - .uploadRangeFromURLWithRestResponseAsync(shareName, filePath, destinationRange.toString(), + .uploadRangeFromUrlWithRestResponseAsync(shareName, filePath, destinationRange.toString(), sourceURI.toString(), 0, null, sourceRange.toString(), null, null, context)) .map(this::uploadRangeFromUrlResponse); } @@ -1137,7 +1137,7 @@ private Response startCopyResponse(final FilesStartCopyResponse re return new SimpleResponse<>(response, fileCopyInfo); } - private Response setPropertiesResponse(final FilesSetHTTPHeadersResponse response) { + private Response setPropertiesResponse(final FilesSetHttpHeadersResponse response) { String eTag = response.getDeserializedHeaders().getETag(); OffsetDateTime lastModified = response.getDeserializedHeaders().getLastModified(); boolean isServerEncrypted = response.getDeserializedHeaders().isServerEncrypted(); @@ -1207,8 +1207,8 @@ private Response uploadResponse(final FilesUploadRangeResponse r } private Response uploadRangeFromUrlResponse( - final FilesUploadRangeFromURLResponse response) { - FileUploadRangeFromURLHeaders headers = response.getDeserializedHeaders(); + final FilesUploadRangeFromUrlResponse response) { + FileUploadRangeFromUrlHeaders headers = response.getDeserializedHeaders(); String eTag = headers.getETag(); OffsetDateTime lastModified = headers.getLastModified(); Boolean isServerEncrypted = headers.isServerEncrypted(); 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 6bb90ad5bf51..ac266671afdb 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 @@ -11,7 +11,7 @@ import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.FileCopyInfo; import com.azure.storage.file.models.FileDownloadInfo; -import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.FileHttpHeaders; import com.azure.storage.file.models.FileInfo; import com.azure.storage.file.models.FileMetadataInfo; import com.azure.storage.file.models.FileProperties; @@ -158,7 +158,7 @@ public FileInfo create(long maxSize) { * @throws RuntimeException if the operation doesn't complete before the timeout concludes. * @see C# identifiers */ - public Response createWithResponse(long maxSize, FileHTTPHeaders httpHeaders, + public Response createWithResponse(long maxSize, FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map metadata, Duration timeout, Context context) { Mono> response = fileAsyncClient @@ -466,8 +466,8 @@ public Response getPropertiesWithResponse(Duration timeout, Cont * @return The {@link FileInfo file info} * @throws IllegalArgumentException thrown if parameters fail the validation. */ - public FileInfo setProperties(long newFileSize, FileHTTPHeaders httpHeaders, FileSmbProperties smbProperties, - String filePermission) { + public FileInfo setProperties(long newFileSize, FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, + String filePermission) { return setPropertiesWithResponse(newFileSize, httpHeaders, smbProperties, filePermission, null, Context.NONE) .getValue(); } @@ -501,7 +501,7 @@ public FileInfo setProperties(long newFileSize, FileHTTPHeaders httpHeaders, Fil * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public Response setPropertiesWithResponse(long newFileSize, FileHTTPHeaders httpHeaders, + public Response setPropertiesWithResponse(long newFileSize, FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Duration timeout, Context context) { Mono> response = fileAsyncClient .setPropertiesWithResponse(newFileSize, httpHeaders, smbProperties, filePermission, context); 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 942a58cc8717..6444c0c7eece 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 @@ -403,7 +403,7 @@ public FileServiceSasSignatureValues setContentType(String contentType) { * {@code expiryTime} or {@code permissions} is null. Or if {@code expiryTime} and {@code permissions} are not set * and {@code identifier} is null */ - public FileServiceSasQueryParameters generateSASQueryParameters(SharedKeyCredential sharedKeyCredentials) { + public FileServiceSasQueryParameters generateSasQueryParameters(SharedKeyCredential sharedKeyCredentials) { Utility.assertNotNull("sharedKeyCredentials", sharedKeyCredentials); assertGenerateOK(); 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 e01c814eb893..494427bf6c6b 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 @@ -25,7 +25,7 @@ import com.azure.storage.file.implementation.models.SharesCreateSnapshotResponse; import com.azure.storage.file.implementation.models.SharesGetPropertiesResponse; import com.azure.storage.file.implementation.models.SharesGetStatisticsResponse; -import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.FileHttpHeaders; import com.azure.storage.file.models.ShareInfo; import com.azure.storage.file.models.ShareProperties; import com.azure.storage.file.models.ShareSnapshotInfo; @@ -685,13 +685,13 @@ public Mono createFile(String fileName, long maxSize) { * */ public Mono> createFileWithResponse(String fileName, long maxSize, - FileHTTPHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, + FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map metadata) { return withContext(context -> createFileWithResponse(fileName, maxSize, httpHeaders, smbProperties, filePermission, metadata, context)); } - Mono> createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, + Mono> createFileWithResponse(String fileName, long maxSize, FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map metadata, Context context) { FileAsyncClient fileAsyncClient = getFileClient(fileName); return postProcessResponse(fileAsyncClient 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 dfcbe1e07c7d..9146d5a0155e 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 @@ -10,7 +10,7 @@ import com.azure.core.util.Context; import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.FileHttpHeaders; import com.azure.storage.file.models.ShareInfo; import com.azure.storage.file.models.ShareProperties; import com.azure.storage.file.models.ShareSnapshotInfo; @@ -606,7 +606,7 @@ public FileClient createFile(String fileName, long maxSize) { * * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public Response createFileWithResponse(String fileName, long maxSize, FileHTTPHeaders httpHeaders, + public Response createFileWithResponse(String fileName, long maxSize, FileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map metadata, Duration timeout, Context context) { FileClient fileClient = getFileClient(fileName); diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java index b689fb105e22..0bc5b7c8526e 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java @@ -31,13 +31,13 @@ import com.azure.storage.file.implementation.models.FilesGetPropertiesResponse; import com.azure.storage.file.implementation.models.FilesGetRangeListResponse; import com.azure.storage.file.implementation.models.FilesListHandlesResponse; -import com.azure.storage.file.implementation.models.FilesSetHTTPHeadersResponse; +import com.azure.storage.file.implementation.models.FilesSetHttpHeadersResponse; import com.azure.storage.file.implementation.models.FilesSetMetadataResponse; import com.azure.storage.file.implementation.models.FilesStartCopyResponse; -import com.azure.storage.file.implementation.models.FilesUploadRangeFromURLResponse; +import com.azure.storage.file.implementation.models.FilesUploadRangeFromUrlResponse; import com.azure.storage.file.implementation.models.FilesUploadRangeResponse; import com.azure.storage.file.models.SourceModifiedAccessConditions; -import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.FileHttpHeaders; import com.azure.storage.file.models.StorageErrorException; import java.nio.ByteBuffer; import java.util.Map; @@ -98,7 +98,7 @@ private interface FilesService { @Put("{shareName}/{filePath}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setHTTPHeaders(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") Long fileContentLength, @HeaderParam("x-ms-file-permission") String filePermission, @HeaderParam("x-ms-file-permission-key") String filePermissionKey, @HeaderParam("x-ms-file-attributes") String fileAttributes, @HeaderParam("x-ms-file-creation-time") String fileCreationTime, @HeaderParam("x-ms-file-last-write-time") String fileLastWriteTime, @QueryParam("comp") String comp, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); + Mono setHTTPHeaders(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") Long fileContentLength, @HeaderParam("x-ms-file-permission") String filePermission, @HeaderParam("x-ms-file-permission-key") String filePermissionKey, @HeaderParam("x-ms-file-attributes") String fileAttributes, @HeaderParam("x-ms-file-creation-time") String fileCreationTime, @HeaderParam("x-ms-file-last-write-time") String fileLastWriteTime, @QueryParam("comp") String comp, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); @Put("{shareName}/{filePath}") @ExpectedResponses({200}) @@ -113,7 +113,7 @@ private interface FilesService { @Put("{shareName}/{filePath}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono uploadRangeFromURL(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-copy-source") String copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-write") String fileRangeWriteFromUrl, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-source-content-crc64") String sourceContentCrc64, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, @HeaderParam("x-ms-source-if-match-crc64") String sourceIfMatchCrc64, @HeaderParam("x-ms-source-if-none-match-crc64") String sourceIfNoneMatchCrc64, Context context); + Mono uploadRangeFromURL(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-copy-source") String copySource, @HeaderParam("x-ms-source-range") String sourceRange, @HeaderParam("x-ms-write") String fileRangeWriteFromUrl, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-source-content-crc64") String sourceContentCrc64, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, @HeaderParam("x-ms-source-if-match-crc64") String sourceIfMatchCrc64, @HeaderParam("x-ms-source-if-none-match-crc64") String sourceIfNoneMatchCrc64, Context context); @Get("{shareName}/{filePath}") @ExpectedResponses({200}) @@ -189,7 +189,7 @@ public Mono createWithRestResponseAsync(String shareName, S * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createWithRestResponseAsync(String shareName, String filePath, long fileContentLength, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Integer timeout, Map metadata, String filePermission, String filePermissionKey, FileHTTPHeaders fileHTTPHeaders, Context context) { + public Mono createWithRestResponseAsync(String shareName, String filePath, long fileContentLength, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Integer timeout, Map metadata, String filePermission, String filePermissionKey, FileHttpHeaders fileHTTPHeaders, Context context) { final String fileTypeConstant = "file"; String fileContentType = null; if (fileHTTPHeaders != null) { @@ -328,7 +328,7 @@ public Mono deleteWithRestResponseAsync(String shareName, S * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Context context) { + public Mono setHttpHeadersWithRestResponseAsync(String shareName, String filePath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Context context) { final Integer timeout = null; final Long fileContentLength = null; final String filePermission = null; @@ -361,7 +361,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Integer timeout, Long fileContentLength, String filePermission, String filePermissionKey, FileHTTPHeaders fileHTTPHeaders, Context context) { + public Mono setHttpHeadersWithRestResponseAsync(String shareName, String filePath, String fileAttributes, String fileCreationTime, String fileLastWriteTime, Integer timeout, Long fileContentLength, String filePermission, String filePermissionKey, FileHttpHeaders fileHTTPHeaders, Context context) { final String comp = "properties"; String fileContentType = null; if (fileHTTPHeaders != null) { @@ -481,7 +481,7 @@ public Mono uploadRangeWithRestResponseAsync(String sh * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadRangeFromURLWithRestResponseAsync(String shareName, String filePath, String range, String copySource, long contentLength, Context context) { + public Mono uploadRangeFromUrlWithRestResponseAsync(String shareName, String filePath, String range, String copySource, long contentLength, Context context) { final Integer timeout = null; final String sourceRange = null; final String fileRangeWriteFromUrl = "update"; @@ -509,7 +509,7 @@ public Mono uploadRangeFromURLWithRestResponseA * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadRangeFromURLWithRestResponseAsync(String shareName, String filePath, String range, String copySource, long contentLength, Integer timeout, String sourceRange, byte[] sourceContentCrc64, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { + public Mono uploadRangeFromUrlWithRestResponseAsync(String shareName, String filePath, String range, String copySource, long contentLength, Integer timeout, String sourceRange, byte[] sourceContentCrc64, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { final String fileRangeWriteFromUrl = "update"; final String comp = "range"; byte[] sourceIfMatchCrc64 = null; diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/models/FileSetHTTPHeadersHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/models/FileSetHTTPHeadersHeaders.java index 0f1096ae5b03..29f591405acc 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/models/FileSetHTTPHeadersHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/models/FileSetHTTPHeadersHeaders.java @@ -15,7 +15,7 @@ */ @JacksonXmlRootElement(localName = "File-SetHTTPHeaders-Headers") @Fluent -public final class FileSetHTTPHeadersHeaders { +public final class FileSetHttpHeadersHeaders { /* * The ETag contains a value which represents the version of the file, in * quotes. @@ -125,7 +125,7 @@ public String getETag() { * @param eTag the eTag value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setETag(String eTag) { + public FileSetHttpHeadersHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -154,7 +154,7 @@ public OffsetDateTime getLastModified() { * @param lastModified the lastModified value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setLastModified(OffsetDateTime lastModified) { + public FileSetHttpHeadersHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -180,7 +180,7 @@ public String getRequestId() { * @param requestId the requestId value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setRequestId(String requestId) { + public FileSetHttpHeadersHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -202,7 +202,7 @@ public String getVersion() { * @param version the version value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setVersion(String version) { + public FileSetHttpHeadersHeaders setVersion(String version) { this.version = version; return this; } @@ -227,7 +227,7 @@ public OffsetDateTime getDateProperty() { * @param dateProperty the dateProperty value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setDateProperty(OffsetDateTime dateProperty) { + public FileSetHttpHeadersHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -255,7 +255,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setIsServerEncrypted(Boolean isServerEncrypted) { + public FileSetHttpHeadersHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -277,7 +277,7 @@ public String getFilePermissionKey() { * @param filePermissionKey the filePermissionKey value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setFilePermissionKey(String filePermissionKey) { + public FileSetHttpHeadersHeaders setFilePermissionKey(String filePermissionKey) { this.filePermissionKey = filePermissionKey; return this; } @@ -297,7 +297,7 @@ public String getFileAttributes() { * @param fileAttributes the fileAttributes value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setFileAttributes(String fileAttributes) { + public FileSetHttpHeadersHeaders setFileAttributes(String fileAttributes) { this.fileAttributes = fileAttributes; return this; } @@ -317,7 +317,7 @@ public OffsetDateTime getFileCreationTime() { * @param fileCreationTime the fileCreationTime value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setFileCreationTime(OffsetDateTime fileCreationTime) { + public FileSetHttpHeadersHeaders setFileCreationTime(OffsetDateTime fileCreationTime) { this.fileCreationTime = fileCreationTime; return this; } @@ -337,7 +337,7 @@ public OffsetDateTime getFileLastWriteTime() { * @param fileLastWriteTime the fileLastWriteTime value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setFileLastWriteTime(OffsetDateTime fileLastWriteTime) { + public FileSetHttpHeadersHeaders setFileLastWriteTime(OffsetDateTime fileLastWriteTime) { this.fileLastWriteTime = fileLastWriteTime; return this; } @@ -357,7 +357,7 @@ public OffsetDateTime getFileChangeTime() { * @param fileChangeTime the fileChangeTime value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setFileChangeTime(OffsetDateTime fileChangeTime) { + public FileSetHttpHeadersHeaders setFileChangeTime(OffsetDateTime fileChangeTime) { this.fileChangeTime = fileChangeTime; return this; } @@ -377,7 +377,7 @@ public String getFileId() { * @param fileId the fileId value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setFileId(String fileId) { + public FileSetHttpHeadersHeaders setFileId(String fileId) { this.fileId = fileId; return this; } @@ -397,7 +397,7 @@ public String getFileParentId() { * @param fileParentId the fileParentId value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setFileParentId(String fileParentId) { + public FileSetHttpHeadersHeaders setFileParentId(String fileParentId) { this.fileParentId = fileParentId; return this; } @@ -417,7 +417,7 @@ public String getErrorCode() { * @param errorCode the errorCode value to set. * @return the FileSetHTTPHeadersHeaders object itself. */ - public FileSetHTTPHeadersHeaders setErrorCode(String errorCode) { + public FileSetHttpHeadersHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/models/FileUploadRangeFromURLHeaders.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/models/FileUploadRangeFromURLHeaders.java index 0e6fefaeed12..86d170817ae4 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/models/FileUploadRangeFromURLHeaders.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/models/FileUploadRangeFromURLHeaders.java @@ -16,7 +16,7 @@ */ @JacksonXmlRootElement(localName = "File-UploadRangeFromURL-Headers") @Fluent -public final class FileUploadRangeFromURLHeaders { +public final class FileUploadRangeFromUrlHeaders { /* * The ETag contains a value which represents the version of the file, in * quotes. @@ -93,7 +93,7 @@ public String getETag() { * @param eTag the eTag value to set. * @return the FileUploadRangeFromURLHeaders object itself. */ - public FileUploadRangeFromURLHeaders setETag(String eTag) { + public FileUploadRangeFromUrlHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -122,7 +122,7 @@ public OffsetDateTime getLastModified() { * @param lastModified the lastModified value to set. * @return the FileUploadRangeFromURLHeaders object itself. */ - public FileUploadRangeFromURLHeaders setLastModified(OffsetDateTime lastModified) { + public FileUploadRangeFromUrlHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -152,7 +152,7 @@ public byte[] getXMsContentCrc64() { * @param xMsContentCrc64 the xMsContentCrc64 value to set. * @return the FileUploadRangeFromURLHeaders object itself. */ - public FileUploadRangeFromURLHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + public FileUploadRangeFromUrlHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); return this; } @@ -174,7 +174,7 @@ public String getRequestId() { * @param requestId the requestId value to set. * @return the FileUploadRangeFromURLHeaders object itself. */ - public FileUploadRangeFromURLHeaders setRequestId(String requestId) { + public FileUploadRangeFromUrlHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -196,7 +196,7 @@ public String getVersion() { * @param version the version value to set. * @return the FileUploadRangeFromURLHeaders object itself. */ - public FileUploadRangeFromURLHeaders setVersion(String version) { + public FileUploadRangeFromUrlHeaders setVersion(String version) { this.version = version; return this; } @@ -221,7 +221,7 @@ public OffsetDateTime getDateProperty() { * @param dateProperty the dateProperty value to set. * @return the FileUploadRangeFromURLHeaders object itself. */ - public FileUploadRangeFromURLHeaders setDateProperty(OffsetDateTime dateProperty) { + public FileUploadRangeFromUrlHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -249,7 +249,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the FileUploadRangeFromURLHeaders object itself. */ - public FileUploadRangeFromURLHeaders setIsServerEncrypted(Boolean isServerEncrypted) { + public FileUploadRangeFromUrlHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -269,7 +269,7 @@ public String getErrorCode() { * @param errorCode the errorCode value to set. * @return the FileUploadRangeFromURLHeaders object itself. */ - public FileUploadRangeFromURLHeaders setErrorCode(String errorCode) { + public FileUploadRangeFromUrlHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/models/FilesSetHTTPHeadersResponse.java b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/models/FilesSetHTTPHeadersResponse.java index 252d6d47ab67..c3550b9ca1a6 100644 --- a/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/models/FilesSetHTTPHeadersResponse.java +++ b/sdk/storage/azure-storage-file/src/main/java/com/azure/storage/file/implementation/models/FilesSetHTTPHeadersResponse.java @@ -11,7 +11,7 @@ /** * Contains all response data for the setHTTPHeaders operation. */ -public final class FilesSetHTTPHeadersResponse extends ResponseBase { +public final class FilesSetHttpHeadersResponse extends ResponseBase { /** * Creates an instance of FilesSetHTTPHeadersResponse. * @@ -21,7 +21,7 @@ public final class FilesSetHTTPHeadersResponse extends ResponseBase { +public final class FilesUploadRangeFromUrlResponse extends ResponseBase { /** * Creates an instance of FilesUploadRangeFromURLResponse. * @@ -21,7 +21,7 @@ public final class FilesUploadRangeFromURLResponse extends ResponseBase { }, @@ -94,7 +94,7 @@ public void createDirectoryAsync() { * Generates a code sample for using {@link DirectoryAsyncClient#createWithResponse(FileSmbProperties, String, Map)} */ public void createDirectoryWithResponseAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.createWithResponse#filesmbproperties-string-map FileSmbProperties smbProperties = new FileSmbProperties(); String filePermission = "filePermission"; @@ -111,7 +111,7 @@ public void createDirectoryWithResponseAsync() { * Generates code sample for creating a subdirectory with {@link DirectoryAsyncClient} */ public void createSubDirectory() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string directoryAsyncClient.createSubDirectory("subdir") .doOnSuccess(response -> System.out.println("Completed creating the subdirectory.")); @@ -122,7 +122,7 @@ public void createSubDirectory() { * Generates a code sample for using {@link DirectoryAsyncClient#createSubDirectoryWithResponse(String, FileSmbProperties, String, Map)} */ public void createSubDirectoryAsyncMaxOverload() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.createSubDirectoryWithResponse#string-filesmbproperties-string-map FileSmbProperties smbProperties = new FileSmbProperties(); String filePermission = "filePermission"; @@ -140,7 +140,7 @@ public void createSubDirectoryAsyncMaxOverload() { * Generates a code sample for using {@link DirectoryAsyncClient#createFile(String, long)} */ public void createFileAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.createFile#string-long directoryAsyncClient.createFile("myfile", 1024).subscribe( response -> { }, @@ -151,12 +151,12 @@ public void createFileAsync() { } /** - * Generates a code sample for using {@link DirectoryAsyncClient#createFileWithResponse(String, long, FileHTTPHeaders, FileSmbProperties, String, Map)} + * Generates a code sample for using {@link DirectoryAsyncClient#createFileWithResponse(String, long, FileHttpHeaders, FileSmbProperties, String, Map)} */ public void createFileWithResponse() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.createFileWithResponse#string-long-filehttpheaders-filesmbproperties-string-map - FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + FileHttpHeaders httpHeaders = new FileHttpHeaders() .setFileContentType("text/html") .setFileContentEncoding("gzip") .setFileContentLanguage("en") @@ -182,7 +182,7 @@ public void createFileWithResponse() { * Generates a code sample for using {@link DirectoryAsyncClient#listFilesAndDirectories()} */ public void listDirectoriesAndFilesAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories directoryAsyncClient.listFilesAndDirectories().subscribe( fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", @@ -197,7 +197,7 @@ public void listDirectoriesAndFilesAsync() { * Generates a code sample for using {@link DirectoryAsyncClient#listFilesAndDirectories(String, Integer)} */ public void listDirectoriesAndFilesAsyncMaxOverload() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories#string-integer directoryAsyncClient.listFilesAndDirectories("subdir", 10).subscribe( fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", @@ -212,7 +212,7 @@ public void listDirectoriesAndFilesAsyncMaxOverload() { * Generates a code sample for using {@link DirectoryAsyncClient#deleteFile(String)} ()} */ public void deleteFileAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteFile#string directoryAsyncClient.deleteFile("myfile").subscribe( response -> { }, @@ -226,7 +226,7 @@ public void deleteFileAsync() { * Generates a code sample for using {@link DirectoryAsyncClient#deleteFileWithResponse(String)} */ public void deleteFileWithResponse() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteFileWithResponse#string directoryAsyncClient.deleteFileWithResponse("myfile").subscribe( response -> System.out.printf("Delete file completed with status code %d", response.getStatusCode()), @@ -240,7 +240,7 @@ public void deleteFileWithResponse() { * Generates a code sample for using {@link DirectoryAsyncClient#deleteSubDirectory(String)} ()} */ public void deleteSubDirectoryAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteSubDirectory#string directoryAsyncClient.deleteSubDirectory("mysubdirectory").subscribe( response -> { }, @@ -254,7 +254,7 @@ public void deleteSubDirectoryAsync() { * Generates a code sample for using {@link DirectoryAsyncClient#deleteSubDirectoryWithResponse(String)} ()} */ public void deleteSubDirectoryWithResponse() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteSubDirectoryWithResponse#string directoryAsyncClient.deleteSubDirectoryWithResponse("mysubdirectory").subscribe( response -> System.out.printf("Delete subdirectory completed with status code %d", response.getStatusCode()), @@ -268,7 +268,7 @@ public void deleteSubDirectoryWithResponse() { * Generates a code sample for using {@link DirectoryAsyncClient#delete()} */ public void deleteDirectoryAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.delete directoryAsyncClient.delete().subscribe( response -> { }, @@ -282,7 +282,7 @@ public void deleteDirectoryAsync() { * Generates a code sample for using {@link DirectoryAsyncClient#deleteWithResponse()} */ public void deleteWithResponse() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.deleteWithResponse directoryAsyncClient.deleteWithResponse().subscribe( response -> System.out.printf("Delete completed with status code %d", response.getStatusCode()), @@ -295,7 +295,7 @@ public void deleteWithResponse() { * Generates a code sample for using {@link DirectoryAsyncClient#getProperties()} */ public void getPropertiesAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.getProperties directoryAsyncClient.getProperties().subscribe(properties -> { System.out.printf("Directory latest modified date is %s.", properties.getLastModified()); @@ -307,7 +307,7 @@ public void getPropertiesAsync() { * Generates a code sample for using {@link DirectoryAsyncClient#getPropertiesWithResponse()} */ public void getPropertiesWithResponse() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.getPropertiesWithResponse directoryAsyncClient.getPropertiesWithResponse().subscribe(properties -> { System.out.printf("Directory latest modified date is %s:", properties.getValue().getLastModified()); @@ -319,7 +319,7 @@ public void getPropertiesWithResponse() { * Generates a code sample for using {@link DirectoryAsyncClient#setProperties(FileSmbProperties, String)} */ public void setPropertiesAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.setProperties#filesmbproperties-string FileSmbProperties smbProperties = new FileSmbProperties(); String filePermission = "filePermission"; @@ -333,7 +333,7 @@ public void setPropertiesAsync() { * Generates a code sample for using {@link DirectoryAsyncClient#setPropertiesWithResponse(FileSmbProperties, String)} */ public void setPropertiesWithResponse() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.setPropertiesWithResponse#filesmbproperties-string FileSmbProperties smbProperties = new FileSmbProperties(); String filePermission = "filePermission"; @@ -347,7 +347,7 @@ public void setPropertiesWithResponse() { * Generates a code sample for using {@link DirectoryAsyncClient#setMetadata(Map)} */ public void setMetadataAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadata#map directoryAsyncClient.setMetadata(Collections.singletonMap("directory", "updatedMetadata")) .subscribe(response -> System.out.println("Setting the directory metadata completed.")); @@ -358,7 +358,7 @@ public void setMetadataAsync() { * Generates a code sample for using {@link DirectoryAsyncClient#setMetadata(Map)} to clear the metadata. */ public void setMetadataClear() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadata#map.clearMetadata directoryAsyncClient.setMetadata(null) .doOnSuccess(response -> System.out.println("Clearing the directory metadata completed")); @@ -369,7 +369,7 @@ public void setMetadataClear() { * Generates a code sample for using {@link DirectoryAsyncClient#setMetadataWithResponse(Map)} to clear the metadata. */ public void setMetadataWithResponseClear() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map.clearMetadata directoryAsyncClient.setMetadataWithResponse(null).subscribe( response -> System.out.printf("Clearing the directory metadata completed with status code %d", @@ -381,7 +381,7 @@ public void setMetadataWithResponseClear() { * Generates a code sample for using {@link DirectoryAsyncClient#setMetadataWithResponse(Map)} */ public void setMetadataWithResponse() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.setMetadataWithResponse#map directoryAsyncClient.setMetadataWithResponse(Collections.singletonMap("directory", "updatedMetadata")) .subscribe(response -> System.out.println("Setting the directory metadata completed with status code:" @@ -393,7 +393,7 @@ public void setMetadataWithResponse() { * Generates a code sample for using {@link DirectoryAsyncClient#listHandles(Integer, boolean)} */ public void listHandlesAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.listHandles#integer-boolean directoryAsyncClient.listHandles(10, true) .subscribe(handleItem -> System.out.printf("Get handles completed with handle id %s", @@ -405,7 +405,7 @@ public void listHandlesAsync() { * Generates a code sample for using {@link DirectoryAsyncClient#forceCloseHandles(String, boolean)} */ public void forceCloseHandlesAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.forceCloseHandles directoryAsyncClient.listHandles(10, true) .subscribe(handleItem -> directoryAsyncClient.forceCloseHandles(handleItem.getHandleId(), true) @@ -435,7 +435,7 @@ public void getShareSnapshotIdAsync() { * Generates a code sample for using {@link DirectoryAsyncClient#getShareName()} */ public void getShareNameAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.getShareName String shareName = directoryAsyncClient.getShareName(); System.out.println("The share name of the directory is " + shareName); @@ -446,7 +446,7 @@ public void getShareNameAsync() { * Generates a code sample for using {@link DirectoryAsyncClient#getDirectoryPath()} */ public void getDirectoryNameAsync() { - DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.getDirectoryPath String directoryPath = directoryAsyncClient.getDirectoryPath(); System.out.println("The name of the directory is " + directoryPath); diff --git a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java index 16055e0b3c3d..40be0e8ab511 100644 --- a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java +++ b/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java @@ -8,7 +8,7 @@ import com.azure.storage.file.models.DirectoryInfo; import com.azure.storage.file.models.DirectoryProperties; import com.azure.storage.file.models.DirectorySetMetadataInfo; -import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.FileHttpHeaders; import com.azure.storage.file.models.HandleItem; import com.azure.storage.file.models.NtfsFileAttributes; @@ -45,7 +45,7 @@ public void initialization() { * * @return An instance of {@link DirectoryClient} */ - public DirectoryClient createClientWithSASToken() { + public DirectoryClient createClientWithSasToken() { // BEGIN: com.azure.storage.file.directoryClient.instantiation.sastoken DirectoryClient directoryClient = new FileClientBuilder() .endpoint("https://${accountName}.file.core.windows.net?${SASToken}") @@ -97,7 +97,7 @@ public DirectoryClient createClientWithConnectionString() { * Generates a code sample for using {@link DirectoryClient#create()} */ public void createDirectory() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.createDirectory directoryClient.create(); System.out.println("Completed creating the directory. "); @@ -109,7 +109,7 @@ public void createDirectory() { * Duration, Context)} */ public void createWithResponse() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.createWithResponse#filesmbproperties-string-map-duration-context FileSmbProperties smbProperties = new FileSmbProperties(); String filePermission = "filePermission"; @@ -123,7 +123,7 @@ public void createWithResponse() { * Generates a code sample for using {@link DirectoryClient#createSubDirectory(String)} */ public void createSubDirectory() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.createSubDirectory#string directoryClient.createSubDirectory("subdir"); System.out.println("Completed creating the subdirectory."); @@ -135,7 +135,7 @@ public void createSubDirectory() { * FileSmbProperties, String, Map, Duration, Context)} */ public void createSubDirectoryMaxOverload() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.createSubDirectoryWithResponse#string-filesmbproperties-string-map-duration-context FileSmbProperties smbProperties = new FileSmbProperties(); String filePermission = "filePermission"; @@ -150,7 +150,7 @@ public void createSubDirectoryMaxOverload() { * Generates a code sample for using {@link DirectoryClient#createFile(String, long)} */ public void createFile() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.createFile#string-long FileClient response = directoryClient.createFile("myfile", 1024); System.out.println("Completed creating the file: " + response); @@ -158,13 +158,13 @@ public void createFile() { } /** - * Generates a code sample for using {@link DirectoryClient#createFileWithResponse(String, long, FileHTTPHeaders, + * Generates a code sample for using {@link DirectoryClient#createFileWithResponse(String, long, FileHttpHeaders, * FileSmbProperties, String, Map, Duration, Context)} */ public void createFileMaxOverload() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.createFile#string-long-filehttpheaders-filesmbproperties-string-map-duration-context - FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + FileHttpHeaders httpHeaders = new FileHttpHeaders() .setFileContentType("text/html") .setFileContentEncoding("gzip") .setFileContentLanguage("en") @@ -188,7 +188,7 @@ public void createFileMaxOverload() { * Generates a code sample for using {@link DirectoryClient#listFilesAndDirectories()} */ public void listDirectoriesAndFiles() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.listFilesAndDirectories directoryClient.listFilesAndDirectories().forEach( fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", @@ -202,7 +202,7 @@ public void listDirectoriesAndFiles() { * Context)} */ public void listDirectoriesAndFilesMaxOverload() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.listFilesAndDirectories#string-integer-duration-context directoryClient.listFilesAndDirectories("subdir", 10, Duration.ofSeconds(1), new Context(key1, value1)).forEach( @@ -216,7 +216,7 @@ public void listDirectoriesAndFilesMaxOverload() { * Generates a code sample for using {@link DirectoryClient#deleteFile(String)} ()} */ public void deleteFile() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.deleteFile#string directoryClient.deleteFile("myfile"); System.out.println("Completed deleting the file."); @@ -227,7 +227,7 @@ public void deleteFile() { * Generates a code sample for using {@link DirectoryClient#deleteFileWithResponse(String, Duration, Context)} */ public void deleteFileWithResponse() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.DirectoryClient.deleteFileWithResponse#string-duration-context Response response = directoryClient.deleteFileWithResponse("myfile", Duration.ofSeconds(1), new Context(key1, value1)); @@ -239,7 +239,7 @@ public void deleteFileWithResponse() { * Generates a code sample for using {@link DirectoryClient#deleteSubDirectory(String)} */ public void deleteSubDirectory() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.deleteSubDirectory#string directoryClient.deleteSubDirectory("mysubdirectory"); System.out.println("Complete deleting the subdirectory."); @@ -251,7 +251,7 @@ public void deleteSubDirectory() { * Context)} */ public void deleteSubDirectoryWithResponse() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.deleteSubDirectoryWithResponse#string-duration-context Response response = directoryClient.deleteSubDirectoryWithResponse("mysubdirectory", Duration.ofSeconds(1), new Context(key1, value1)); @@ -263,7 +263,7 @@ public void deleteSubDirectoryWithResponse() { * Generates a code sample for using {@link DirectoryClient#delete()} */ public void deleteDirectory() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.delete directoryClient.delete(); System.out.println("Completed deleting the file."); @@ -274,7 +274,7 @@ public void deleteDirectory() { * Generates a code sample for using {@link DirectoryClient#deleteWithResponse(Duration, Context)} */ public void deleteWithResponse() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.DirectoryClient.deleteWithResponse#duration-context Response response = directoryClient.deleteWithResponse(Duration.ofSeconds(1), new Context(key1, value1)); System.out.println("Completed deleting the file with status code: " + response.getStatusCode()); @@ -285,7 +285,7 @@ public void deleteWithResponse() { * Generates a code sample for using {@link DirectoryClient#getProperties()} */ public void getProperties() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.getProperties DirectoryProperties response = directoryClient.getProperties(); System.out.printf("Directory latest modified date is %s.", response.getLastModified()); @@ -296,7 +296,7 @@ public void getProperties() { * Generates a code sample for using {@link DirectoryClient#getPropertiesWithResponse(Duration, Context)} */ public void getPropertiesWithResponse() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.DirectoryClient.getPropertiesWithResponse#duration-Context Response response = directoryClient.getPropertiesWithResponse( Duration.ofSeconds(1), new Context(key1, value1)); @@ -308,7 +308,7 @@ public void getPropertiesWithResponse() { * Generates a code sample for using {@link DirectoryClient#setProperties(FileSmbProperties, String)} */ public void setProperties() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.setProperties#filesmbproperties-string FileSmbProperties smbProperties = new FileSmbProperties(); String filePermission = "filePermission"; @@ -322,7 +322,7 @@ public void setProperties() { * Duration, Context)} */ public void setPropertiesWithResponse() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.setPropertiesWithResponse#filesmbproperties-string-duration-Context FileSmbProperties smbProperties = new FileSmbProperties(); String filePermission = "filePermission"; @@ -336,7 +336,7 @@ public void setPropertiesWithResponse() { * Generates a code sample for using {@link DirectoryClient#setMetadata(Map)} */ public void setMetadata() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.setMetadata#map DirectorySetMetadataInfo response = directoryClient.setMetadata(Collections.singletonMap("directory", "updatedMetadata")); @@ -348,7 +348,7 @@ public void setMetadata() { * Generates a code sample for using {@link DirectoryClient#setMetadataWithResponse(Map, Duration, Context)} */ public void setMetadataWithResponse() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.setMetadataWithResponse#map-duration-context Response response = directoryClient.setMetadataWithResponse(Collections.singletonMap("directory", "updatedMetadata"), @@ -361,7 +361,7 @@ public void setMetadataWithResponse() { * Generates a code sample for using {@link DirectoryClient#setMetadata(Map)} to clear the metadata. */ public void clearSetMetadata() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.setMetadata#map.clearMetadata DirectorySetMetadataInfo response = directoryClient.setMetadata(null); System.out.printf("Cleared metadata."); @@ -372,7 +372,7 @@ public void clearSetMetadata() { * Generates a code sample for using {@link DirectoryClient#setMetadata(Map)} to clear the metadata. */ public void clearMetadata() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.DirectoryClient.setMetadataWithResponse#map-duration-context.clearMetadata Response response = directoryClient.setMetadataWithResponse(null, Duration.ofSeconds(1), new Context(key1, value1)); @@ -384,7 +384,7 @@ public void clearMetadata() { * Generates a code sample for using {@link DirectoryClient#listHandles(Integer, boolean, Duration, Context)} */ public void listHandles() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.listHandles#Integer-boolean-duration-context Iterable result = directoryClient.listHandles(10, true, Duration.ofSeconds(1), new Context(key1, value1)); @@ -396,7 +396,7 @@ public void listHandles() { * Generates a code sample for using {@link DirectoryClient#forceCloseHandles(String, boolean, Duration, Context)} */ public void forceCloseHandles() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.forceCloseHandles Iterable result = directoryClient.listHandles(10, true, Duration.ofSeconds(1), new Context(key1, value1)); @@ -429,7 +429,7 @@ public void getShareSnapshotId() { * Generates a code sample for using {@link DirectoryClient#getShareName()} */ public void getShareName() { - DirectoryClient directoryAsyncClient = createClientWithSASToken(); + DirectoryClient directoryAsyncClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.getShareName String shareName = directoryAsyncClient.getShareName(); System.out.println("The share name of the directory is " + shareName); @@ -440,7 +440,7 @@ public void getShareName() { * Generates a code sample for using {@link DirectoryClient#getDirectoryPath()} */ public void getDirectoryPath() { - DirectoryClient directoryClient = createClientWithSASToken(); + DirectoryClient directoryClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.directoryClient.getDirectoryPath String directoryPath = directoryClient.getDirectoryPath(); System.out.println("The name of the directory is " + directoryPath); 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 1923c2416b73..15dff7506774 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 @@ -3,7 +3,7 @@ package com.azure.storage.file; import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.FileHttpHeaders; import com.azure.storage.file.models.FileProperties; import com.azure.storage.file.models.FileRange; import com.azure.storage.file.models.NtfsFileAttributes; @@ -43,7 +43,7 @@ public void asyncInitialization() { * Generates code sample for creating a {@link FileAsyncClient} with SAS token. * @return An instance of {@link FileAsyncClient} */ - public FileAsyncClient createAsyncClientWithSASToken() { + public FileAsyncClient createAsyncClientWithSasToken() { // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.sastoken FileAsyncClient fileAsyncClient = new FileClientBuilder() .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") @@ -91,7 +91,7 @@ public FileAsyncClient createAsyncClientWithConnectionString() { * Generates a code sample for using {@link FileAsyncClient#create(long)} */ public void createFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.create fileAsyncClient.create(1024).subscribe( response -> { }, @@ -105,21 +105,21 @@ public void createFileAsync() { * Generates a code sample for using {@link FileAsyncClient#create(long)} */ public void createFileAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.create#long-filehttpheaders-map - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().setFileContentType("text/plain"); + FileHttpHeaders httpHeaders = new FileHttpHeaders().setFileContentType("text/plain"); fileAsyncClient.create(1024) .doOnSuccess(response -> System.out.println("Creating the file completed.")); // END: com.azure.storage.file.fileAsyncClient.create#long-filehttpheaders-map } /** - * Generates a code sample for using {@link FileAsyncClient#createWithResponse(long, FileHTTPHeaders, FileSmbProperties, String, Map)} + * Generates a code sample for using {@link FileAsyncClient#createWithResponse(long, FileHttpHeaders, FileSmbProperties, String, Map)} */ public void createWithResponse() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.createWithResponse#long-filehttpheaders-filesmbproperties-string-map - FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + FileHttpHeaders httpHeaders = new FileHttpHeaders() .setFileContentType("text/html") .setFileContentEncoding("gzip") .setFileContentLanguage("en") @@ -143,7 +143,7 @@ public void createWithResponse() { * Generates a code sample for using {@link FileAsyncClient#startCopy(String, Map)} */ public void copyFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.startCopy#string-map fileAsyncClient.startCopy("https://{accountName}.file.core.windows.net?{SASToken}", Collections.singletonMap("file", "metadata")).subscribe( @@ -158,7 +158,7 @@ public void copyFileAsync() { * Generates a code sample for using {@link FileAsyncClient#startCopyWithResponse(String, Map)} */ public void startCopyWithResponse() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.startCopyWithResponse#string-map fileAsyncClient.startCopyWithResponse("https://{accountName}.file.core.windows.net?{SASToken}", Collections.singletonMap("file", "metadata")).subscribe( @@ -173,7 +173,7 @@ public void startCopyWithResponse() { * Generates a code sample for using {@link FileAsyncClient#abortCopy(String)} */ public void abortCopyFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.abortCopy#string fileAsyncClient.abortCopy("someCopyId") .doOnSuccess(response -> System.out.println("Abort copying the file completed.")); @@ -184,7 +184,7 @@ public void abortCopyFileAsync() { * Generates a code sample for using {@link FileAsyncClient#abortCopyWithResponse(String)} */ public void abortCopyWithResponse() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.abortCopyWithResponse#string fileAsyncClient.abortCopyWithResponse("someCopyId") .subscribe(response -> System.out.printf("Abort copying the file completed with status code %d", @@ -196,7 +196,7 @@ public void abortCopyWithResponse() { * Generates a code sample for using {@link FileAsyncClient#upload(Flux, long)} */ public void uploadDataAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.upload#flux-long ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); fileAsyncClient.upload(Flux.just(defaultData), defaultData.remaining()).subscribe( @@ -211,7 +211,7 @@ public void uploadDataAsync() { * Generates a code sample for using {@link FileAsyncClient#upload(Flux, long, long)} */ public void uploadDataMaxOverloadAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.upload#flux-long-long ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); fileAsyncClient.upload(Flux.just(defaultData), defaultData.remaining()).subscribe( @@ -226,7 +226,7 @@ public void uploadDataMaxOverloadAsync() { * Generates a code sample for using {@link FileAsyncClient#uploadWithResponse(Flux, long)} */ public void uploadWithResponse() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); fileAsyncClient.uploadWithResponse(Flux.just(defaultData), defaultData.remaining()).subscribe( @@ -240,7 +240,7 @@ public void uploadWithResponse() { * Generates a code sample for using {@link FileAsyncClient#uploadWithResponse(Flux, long, long)} */ public void uploadWithResponseOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.uploadWithResponse#flux-long-long ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); fileAsyncClient.uploadWithResponse(Flux.just(defaultData), defaultData.remaining(), 1024).subscribe( @@ -254,7 +254,7 @@ public void uploadWithResponseOverload() { * Generates a code sample for using {@link FileAsyncClient#clearRange(long)} */ public void clearRangeAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.clearRange#long fileAsyncClient.clearRange(1024).subscribe( response -> { }, @@ -268,7 +268,7 @@ public void clearRangeAsync() { * Generates a code sample for using {@link FileAsyncClient#clearRangeWithResponse(long, long)} */ public void clearRangeAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.clearRange#long-long fileAsyncClient.clearRangeWithResponse(1024, 1024).subscribe( response -> { }, @@ -282,7 +282,7 @@ public void clearRangeAsyncMaxOverload() { * Generates a code sample for using {@link FileAsyncClient#uploadFromFile(String)} */ public void uploadFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.uploadFromFile#string fileAsyncClient.uploadFromFile("someFilePath").subscribe( response -> { }, @@ -296,8 +296,8 @@ public void uploadFileAsync() { * Generates a code sample for using {@link FileAsyncClient#uploadRangeFromUrl(long, long, long, URI)} * @throws URISyntaxException when the URI is invalid */ - public void uploadFileFromURLAsync() throws URISyntaxException { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + public void uploadFileFromUrlAsync() throws URISyntaxException { + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.uploadRangeFromUrl#long-long-long-uri fileAsyncClient.uploadRangeFromUrl(6, 8, 0, new URI("filewithSAStoken")).subscribe( response -> { }, @@ -311,8 +311,8 @@ public void uploadFileFromURLAsync() throws URISyntaxException { * Generates a code sample for using {@link FileAsyncClient#uploadRangeFromUrlWithResponse(long, long, long, URI)} * @throws URISyntaxException when the URI is invalid */ - public void uploadFileFromURLWithResponseAsync() throws URISyntaxException { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + public void uploadFileFromUrlWithResponseAsync() throws URISyntaxException { + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.uploadRangeFromUrlWithResponse#long-long-long-uri fileAsyncClient.uploadRangeFromUrlWithResponse(6, 8, 0, new URI("filewithSAStoken")).subscribe( response -> { }, @@ -326,7 +326,7 @@ public void uploadFileFromURLWithResponseAsync() throws URISyntaxException { * Generates a code sample for using {@link FileAsyncClient#downloadWithProperties()} */ public void downloadDataAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.downloadWithProperties fileAsyncClient.downloadWithProperties().subscribe( response -> { }, @@ -340,7 +340,7 @@ public void downloadDataAsync() { * Generates a code sample for using {@link FileAsyncClient#downloadWithPropertiesWithResponse(FileRange, Boolean)} */ public void downloadDataAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.downloadWithProperties#filerange-boolean fileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(1024, 2047L), false). subscribe( @@ -355,7 +355,7 @@ public void downloadDataAsyncMaxOverload() { * Generates a code sample for using {@link FileAsyncClient#downloadWithPropertiesWithResponse(FileRange, Boolean)} */ public void downloadWithPropertiesWithResponse() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.downloadWithPropertiesWithResponse#filerange-boolean fileAsyncClient.downloadWithPropertiesWithResponse(new FileRange(1024, 2047L), false) .subscribe( @@ -369,7 +369,7 @@ public void downloadWithPropertiesWithResponse() { * Generates a code sample for using {@link FileAsyncClient#downloadToFile(String)} */ public void downloadFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.downloadToFile#string fileAsyncClient.downloadToFile("somelocalfilepath").subscribe( response -> { @@ -387,7 +387,7 @@ public void downloadFileAsync() { * Generates a code sample for using {@link FileAsyncClient#downloadToFileWithResponse(String, FileRange)} */ public void downloadFileAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.downloadToFileWithResponse#string-filerange fileAsyncClient.downloadToFileWithResponse("somelocalfilepath", new FileRange(1024, 2047L)) .subscribe( @@ -407,7 +407,7 @@ public void downloadFileAsyncMaxOverload() { * Generates a code sample for using {@link FileAsyncClient#delete()} */ public void deleteFileAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.delete fileAsyncClient.delete().subscribe( response -> { }, @@ -421,7 +421,7 @@ public void deleteFileAsync() { * Generates a code sample for using {@link FileAsyncClient#deleteWithResponse()} */ public void deleteWithResponse() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.deleteWithResponse fileAsyncClient.deleteWithResponse().subscribe( response -> System.out.println("Complete deleting the file with status code:" + response.getStatusCode()), @@ -434,7 +434,7 @@ public void deleteWithResponse() { * Generates a code sample for using {@link FileAsyncClient#getProperties()} */ public void getPropertiesAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.getProperties fileAsyncClient.getProperties() .subscribe(properties -> { @@ -447,7 +447,7 @@ public void getPropertiesAsync() { * Generates a code sample for using {@link FileAsyncClient#getPropertiesWithResponse()} */ public void getPropertiesWithResponse() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.getPropertiesWithResponse fileAsyncClient.getPropertiesWithResponse() .subscribe(response -> { @@ -461,7 +461,7 @@ public void getPropertiesWithResponse() { * Generates a code sample for using {@link FileAsyncClient#setMetadata(Map)} */ public void setMetadataAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadata#map fileAsyncClient.setMetadata(Collections.singletonMap("file", "updatedMetadata")) .doOnSuccess(response -> System.out.println("Setting the file metadata completed.")); @@ -472,7 +472,7 @@ public void setMetadataAsync() { * Generates a code sample for using {@link FileAsyncClient#setMetadata(Map)} */ public void setMetadataWithResponse() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map fileAsyncClient.setMetadataWithResponse(Collections.singletonMap("file", "updatedMetadata")) .subscribe(response -> System.out.printf("Setting the file metadata completed with status code %d", @@ -484,7 +484,7 @@ public void setMetadataWithResponse() { * Generates a code sample for using {@link FileAsyncClient#setMetadataWithResponse(Map)} to clear metadata. */ public void clearMetadataAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadataWithResponse#map.clearMetadata fileAsyncClient.setMetadataWithResponse(null).subscribe( response -> System.out.printf("Setting the file metadata completed with status code %d", @@ -496,7 +496,7 @@ public void clearMetadataAsync() { * Generates a code sample for using {@link FileAsyncClient#setMetadata(Map)} to clear metadata. */ public void clearMetadata() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.setMetadata#map.clearMetadata fileAsyncClient.setMetadata(null).subscribe( response -> System.out.println("Setting the file metadata completed.") @@ -505,12 +505,12 @@ public void clearMetadata() { } /** - * Generates a code sample for using {@link FileAsyncClient#setProperties(long, FileHTTPHeaders, FileSmbProperties, String)} + * Generates a code sample for using {@link FileAsyncClient#setProperties(long, FileHttpHeaders, FileSmbProperties, String)} */ public void setFilePropertiesAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.setProperties#long-filehttpheaders-filesmbproperties-string - FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + FileHttpHeaders httpHeaders = new FileHttpHeaders() .setFileContentType("text/html") .setFileContentEncoding("gzip") .setFileContentLanguage("en") @@ -529,12 +529,12 @@ public void setFilePropertiesAsync() { } /** - * Generates a code sample for using {@link FileAsyncClient#setPropertiesWithResponse(long, FileHTTPHeaders, FileSmbProperties, String)} + * Generates a code sample for using {@link FileAsyncClient#setPropertiesWithResponse(long, FileHttpHeaders, FileSmbProperties, String)} */ public void setHttpHeadersWithResponse() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string - FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + FileHttpHeaders httpHeaders = new FileHttpHeaders() .setFileContentType("text/html") .setFileContentEncoding("gzip") .setFileContentLanguage("en") @@ -554,11 +554,11 @@ public void setHttpHeadersWithResponse() { } /** - * Generates a code sample for using {@link FileAsyncClient#setPropertiesWithResponse(long, FileHTTPHeaders, FileSmbProperties, String)} + * Generates a code sample for using {@link FileAsyncClient#setPropertiesWithResponse(long, FileHttpHeaders, FileSmbProperties, String)} * to clear httpHeaders. */ - public void clearHTTPHeadersAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + public void clearHttpHeadersAsync() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string.clearHttpHeaderspreserveSMBProperties fileAsyncClient.setPropertiesWithResponse(1024, null, null, null) .subscribe(response -> System.out.printf("Setting the file httpHeaders completed with status code %d", @@ -567,11 +567,11 @@ public void clearHTTPHeadersAsync() { } /** - * Generates a code sample for using {@link FileAsyncClient#setProperties(long, FileHTTPHeaders, FileSmbProperties, String)} + * Generates a code sample for using {@link FileAsyncClient#setProperties(long, FileHttpHeaders, FileSmbProperties, String)} * to clear httpHeaders. */ - public void clearHTTPHeaders() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + public void clearHttpHeaders() { + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.setProperties#long-filehttpheaders-filesmbproperties-string.clearHttpHeaderspreserveSMBProperties fileAsyncClient.setProperties(1024, null, null, null) .subscribe(response -> System.out.println("Setting the file httpHeaders completed.")); @@ -582,7 +582,7 @@ public void clearHTTPHeaders() { * Generates a code sample for using {@link FileAsyncClient#listRanges()} */ public void listRangesAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.listRanges fileAsyncClient.listRanges().subscribe(range -> System.out.printf("List ranges completed with start: %d, end: %d", range.getStart(), range.getEnd())); @@ -593,7 +593,7 @@ public void listRangesAsync() { * Generates a code sample for using {@link FileAsyncClient#listRanges(FileRange)} */ public void listRangesAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.listRanges#filerange fileAsyncClient.listRanges(new FileRange(1024, 2048L)) .subscribe(result -> System.out.printf("List ranges completed with start: %d, end: %d", @@ -605,7 +605,7 @@ public void listRangesAsyncMaxOverload() { * Generates a code sample for using {@link FileAsyncClient#listHandles()} */ public void listHandlesAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.listHandles fileAsyncClient.listHandles() .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.getHandleId())); @@ -616,7 +616,7 @@ public void listHandlesAsync() { * Generates a code sample for using {@link FileAsyncClient#listHandles(Integer)} */ public void listHandlesAsyncMaxOverload() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.listHandles#integer fileAsyncClient.listHandles(10) .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.getHandleId())); @@ -627,7 +627,7 @@ public void listHandlesAsyncMaxOverload() { * Generates a code sample for using {@link FileAsyncClient#forceCloseHandles(String)} */ public void forceCloseHandlesAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.forceCloseHandles#string fileAsyncClient.listHandles(10) .subscribe(result -> { @@ -659,7 +659,7 @@ public void getShareSnapshotIdAsync() { * Generates a code sample for using {@link FileAsyncClient#getShareName()} */ public void getShareNameAsync() { - FileAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient directoryAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.getShareName String shareName = directoryAsyncClient.getShareName(); System.out.println("The share name of the directory is " + shareName); @@ -670,7 +670,7 @@ public void getShareNameAsync() { * Generates a code sample for using {@link FileAsyncClient#getFilePath()} */ public void getFilePathAsync() { - FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); + FileAsyncClient fileAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.getFilePath String filePath = fileAsyncClient.getFilePath(); System.out.println("The name of the file is " + filePath); 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 d4ed5f6b1ef2..8ca296400787 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 @@ -7,7 +7,7 @@ import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.FileCopyInfo; import com.azure.storage.file.models.FileDownloadInfo; -import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.FileHttpHeaders; import com.azure.storage.file.models.FileInfo; import com.azure.storage.file.models.FileMetadataInfo; import com.azure.storage.file.models.FileProperties; @@ -53,7 +53,7 @@ public void initialization() { * Generates code sample for creating a {@link FileClient} with SAS token. * @return An instance of {@link FileClient} */ - public FileClient createClientWithSASToken() { + public FileClient createClientWithSasToken() { // BEGIN: com.azure.storage.file.fileClient.instantiation.sastoken FileClient fileClient = new FileClientBuilder() @@ -103,7 +103,7 @@ public FileClient createClientWithConnectionString() { * Generates a code sample for using {@link FileClient#create(long)} */ public void createFile() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.create FileInfo response = fileClient.create(1024); System.out.println("Complete creating the file."); @@ -111,13 +111,13 @@ public void createFile() { } /** - * Generates a code sample for using {@link FileClient#createWithResponse(long, FileHTTPHeaders, FileSmbProperties, + * Generates a code sample for using {@link FileClient#createWithResponse(long, FileHttpHeaders, FileSmbProperties, * String, Map, Duration, Context)} */ public void createWithResponse() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.createWithResponse#long-filehttpheaders-filesmbproperties-string-map-duration-context - FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + FileHttpHeaders httpHeaders = new FileHttpHeaders() .setFileContentType("text/html") .setFileContentEncoding("gzip") .setFileContentLanguage("en") @@ -140,7 +140,7 @@ public void createWithResponse() { * Generates a code sample for using {@link FileClient#startCopy(String, Map)} */ public void startCopy() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.startCopy#string-map FileCopyInfo response = fileClient.startCopy( "https://{accountName}.file.core.windows.net?{SASToken}", @@ -153,7 +153,7 @@ public void startCopy() { * Generates a code sample for using {@link FileClient#startCopyWithResponse(String, Map, Duration, Context)} */ public void startCopyWithResponse() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.startCopyWithResponse#string-map-duration-context Response response = fileClient.startCopyWithResponse( "https://{accountName}.file.core.windows.net?{SASToken}", @@ -166,7 +166,7 @@ public void startCopyWithResponse() { * Generates a code sample for using {@link FileClient#abortCopy(String)} */ public void abortCopyFile() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.abortCopy#string fileClient.abortCopy("someCopyId"); System.out.printf("Abort copying the file completed."); @@ -177,7 +177,7 @@ public void abortCopyFile() { * Generates a code sample for using {@link FileClient#abortCopyWithResponse(String, Duration, Context)} */ public void abortCopyWithResponse() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.abortCopyWithResponse#string-duration-context Response response = fileClient.abortCopyWithResponse("someCopyId", Duration.ofSeconds(1), new Context(key1, value1)); @@ -189,7 +189,7 @@ public void abortCopyWithResponse() { * Generates a code sample for using {@link FileClient#upload(ByteBuffer, long)} */ public void uploadData() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.upload#bytebuffer-long ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); FileUploadInfo response = fileClient.upload(defaultData, defaultData.remaining()); @@ -201,7 +201,7 @@ public void uploadData() { * Generates a code sample for using {@link FileClient#uploadWithResponse(ByteBuffer, long, Duration, Context)} */ public void uploadWithResponse() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.FileClient.uploadWithResponse#ByteBuffer-long-Duration-Context ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); Response response = fileClient.uploadWithResponse(defaultData, defaultData.remaining(), @@ -215,7 +215,7 @@ public void uploadWithResponse() { * Duration, Context)} */ public void uploadWithResponseMaxOverload() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.FileClient.uploadWithResponse#ByteBuffer-long-long-Duration-Context ByteBuffer defaultData = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); Response response = fileClient.uploadWithResponse(defaultData, defaultData.remaining(), @@ -228,7 +228,7 @@ public void uploadWithResponseMaxOverload() { * Generates a code sample for using {@link FileClient#clearRange(long)} */ public void clearRange() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.clearRange#long FileUploadInfo response = fileClient.clearRange(1024); System.out.println("Complete clearing the range with eTag: " + response.getETag()); @@ -239,7 +239,7 @@ public void clearRange() { * Generates a code sample for using {@link FileClient#clearRangeWithResponse(long, long, Duration, Context)} */ public void clearRangeMaxOverload() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.FileClient.clearRangeWithResponse#long-long-Duration-Context Response response = fileClient.clearRangeWithResponse(1024, 1024, Duration.ofSeconds(1), new Context(key1, value1)); @@ -251,7 +251,7 @@ public void clearRangeMaxOverload() { * Generates a code sample for using {@link FileClient#uploadFromFile(String)} */ public void uploadFile() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.uploadFromFile#string fileClient.uploadFromFile("someFilePath"); // END: com.azure.storage.file.fileClient.uploadFromFile#string @@ -261,7 +261,7 @@ public void uploadFile() { * Generates a code sample for using {@link FileClient#uploadFromFile(String)} */ public void uploadFileMaxOverload() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.uploadFromFile#string-filerangewritetype fileClient.uploadFromFile("someFilePath"); if (fileClient.getProperties() != null) { @@ -275,7 +275,7 @@ public void uploadFileMaxOverload() { * Generates a code sample for using {@link FileClient#downloadWithProperties()} */ public void downloadData() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.downloadWithProperties FileDownloadInfo response = fileClient.downloadWithProperties(); System.out.println("Complete downloading the data."); @@ -293,7 +293,7 @@ public void downloadData() { * FileRange, Boolean, Duration, Context)} */ public void downloadWithPropertiesWithResponse() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.FileClient.downloadWithPropertiesWithResponse#FileRange-Boolean-Duration-Context Response response = fileClient.downloadWithPropertiesWithResponse(new FileRange(1024, 2047L), false, Duration.ofSeconds(1), new Context(key1, value1)); @@ -311,7 +311,7 @@ public void downloadWithPropertiesWithResponse() { * Generates a code sample for using {@link FileClient#downloadToFile(String)} */ public void downloadFile() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.downloadToFile#string fileClient.downloadToFile("somelocalfilepath"); if (Files.exists(Paths.get("somelocalfilepath"))) { @@ -324,7 +324,7 @@ public void downloadFile() { * Generates a code sample for using {@link FileClient#downloadToFileWithResponse(String, FileRange, Duration, Context)} */ public void downloadFileMaxOverload() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.downloadToFileWithResponse#string-filerange-duration-context Response response = fileClient.downloadToFileWithResponse("somelocalfilepath", new FileRange(1024, 2047L), @@ -339,8 +339,8 @@ public void downloadFileMaxOverload() { * Generates a code sample for using {@link FileClient#uploadRangeFromUrl(long, long, long, URI)} * @throws URISyntaxException when the URI is invalid */ - public void uploadFileFromURLAsync() throws URISyntaxException { - FileClient fileClient = createClientWithSASToken(); + public void uploadFileFromUrlAsync() throws URISyntaxException { + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.uploadRangeFromUrl#long-long-long-uri FileUploadRangeFromUrlInfo response = fileClient.uploadRangeFromUrl(6, 8, 0, new URI("filewithSAStoken")); System.out.println("Completed upload range from url!"); @@ -351,8 +351,8 @@ public void uploadFileFromURLAsync() throws URISyntaxException { * Generates a code sample for using {@link FileClient#uploadRangeFromUrlWithResponse(long, long, long, URI, Duration, Context)} * @throws URISyntaxException when the URI is invalid */ - public void uploadFileFromURLWithResponseAsync() throws URISyntaxException { - FileClient fileClient = createClientWithSASToken(); + public void uploadFileFromUrlWithResponseAsync() throws URISyntaxException { + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.uploadRangeFromUrlWithResponse#long-long-long-uri-duration-context Response response = fileClient.uploadRangeFromUrlWithResponse(6, 8, 0, new URI("filewithSAStoken"), Duration.ofSeconds(1), Context.NONE); @@ -364,7 +364,7 @@ public void uploadFileFromURLWithResponseAsync() throws URISyntaxException { * Generates a code sample for using {@link FileClient#delete()} */ public void deleteFile() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.delete fileClient.delete(); System.out.println("Complete deleting the file."); @@ -375,7 +375,7 @@ public void deleteFile() { * Generates a code sample for using {@link FileClient#deleteWithResponse(Duration, Context)} */ public void deleteWithResponse() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.deleteWithResponse#duration-context Response response = fileClient.deleteWithResponse(Duration.ofSeconds(1), new Context(key1, value1)); System.out.println("Complete deleting the file with status code: " + response.getStatusCode()); @@ -386,7 +386,7 @@ public void deleteWithResponse() { * Generates a code sample for using {@link FileClient#getProperties()} */ public void getProperties() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.getProperties FileProperties properties = fileClient.getProperties(); System.out.printf("File latest modified date is %s.", properties.getLastModified()); @@ -397,7 +397,7 @@ public void getProperties() { * Generates a code sample for using {@link FileClient#getPropertiesWithResponse(Duration, Context)} */ public void getPropertiesWithResponse() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.getPropertiesWithResponse#duration-context Response response = fileClient.getPropertiesWithResponse( Duration.ofSeconds(1), new Context(key1, value1)); @@ -409,7 +409,7 @@ public void getPropertiesWithResponse() { * Generates a code sample for using {@link FileClient#setMetadata(Map)} */ public void setMetadata() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.setMetadata#map fileClient.setMetadata(Collections.singletonMap("file", "updatedMetadata")); System.out.println("Setting the file metadata completed."); @@ -420,7 +420,7 @@ public void setMetadata() { * Generates a code sample for using {@link FileClient#setMetadataWithResponse(Map, Duration, Context)} */ public void setMetadataWithResponse() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.setMetadataWithResponse#map-duration-context Response response = fileClient.setMetadataWithResponse( Collections.singletonMap("file", "updatedMetadata"), Duration.ofSeconds(1), new Context(key1, value1)); @@ -433,7 +433,7 @@ public void setMetadataWithResponse() { * Duration, Context)} to clear metadata. */ public void clearMetadataWithResponse() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.setMetadataWithResponse#map-duration-context.clearMetadata Response response = fileClient.setMetadataWithResponse(null, Duration.ofSeconds(1), new Context(key1, value1)); @@ -445,7 +445,7 @@ public void clearMetadataWithResponse() { * Generates a code sample for using {@link FileClient#setMetadata(Map)} to clear metadata. */ public void clearMetadata() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.setMetadata#map.clearMetadata fileClient.setMetadata(null); System.out.printf("Setting the file metadata completed."); @@ -453,12 +453,12 @@ public void clearMetadata() { } /** - * Generates a code sample for using {@link FileClient#setProperties(long, FileHTTPHeaders, FileSmbProperties, String)} + * Generates a code sample for using {@link FileClient#setProperties(long, FileHttpHeaders, FileSmbProperties, String)} */ - public void setHTTPHeaders() { - FileClient fileClient = createClientWithSASToken(); + public void setHttpHeaders() { + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.setProperties#long-filehttpheaders-filesmbproperties-string - FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + FileHttpHeaders httpHeaders = new FileHttpHeaders() .setFileContentType("text/html") .setFileContentEncoding("gzip") .setFileContentLanguage("en") @@ -477,11 +477,11 @@ public void setHTTPHeaders() { } /** - * Generates a code sample for using {@link FileClient#setProperties(long, FileHTTPHeaders, FileSmbProperties, String)} + * Generates a code sample for using {@link FileClient#setProperties(long, FileHttpHeaders, FileSmbProperties, String)} * to clear httpHeaders and preserve SMB properties. */ - public void clearSyncHTTPHeaders() { - FileClient fileClient = createClientWithSASToken(); + public void clearSyncHttpHeaders() { + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.setProperties#long-filehttpheaders-filesmbproperties-string.clearHttpHeaderspreserveSMBProperties FileInfo response = fileClient.setProperties(1024, null, null, null); System.out.printf("Setting the file httpHeaders completed."); @@ -489,13 +489,13 @@ public void clearSyncHTTPHeaders() { } /** - * Generates a code sample for using {@link FileClient#setPropertiesWithResponse(long, FileHTTPHeaders, + * Generates a code sample for using {@link FileClient#setPropertiesWithResponse(long, FileHttpHeaders, * FileSmbProperties, String, Duration, Context)} */ public void setHttpHeadersWithResponse() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string-duration-Context - FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + FileHttpHeaders httpHeaders = new FileHttpHeaders() .setFileContentType("text/html") .setFileContentEncoding("gzip") .setFileContentLanguage("en") @@ -515,11 +515,11 @@ public void setHttpHeadersWithResponse() { } /** - * Generates a code sample for using {@link FileClient#setPropertiesWithResponse(long, FileHTTPHeaders, FileSmbProperties, String, Duration, Context)} + * Generates a code sample for using {@link FileClient#setPropertiesWithResponse(long, FileHttpHeaders, FileSmbProperties, String, Duration, Context)} * (long, FileHTTPHeaders)} to clear httpHeaders. */ - public void clearHTTPHeaders() { - FileClient fileClient = createClientWithSASToken(); + public void clearHttpHeaders() { + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.setPropertiesWithResponse#long-filehttpheaders-filesmbproperties-string-duration-Context.clearHttpHeaderspreserveSMBProperties Response response = fileClient.setPropertiesWithResponse(1024, null, null, null, Duration.ofSeconds(1), new Context(key1, value1)); @@ -531,7 +531,7 @@ public void clearHTTPHeaders() { * Generates a code sample for using {@link FileClient#listRanges()} */ public void listRanges() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.listRanges Iterable ranges = fileClient.listRanges(); ranges.forEach(range -> @@ -543,7 +543,7 @@ public void listRanges() { * Generates a code sample for using {@link FileClient#listRanges(FileRange, Duration, Context)} */ public void listRangesMaxOverload() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.listRanges#filerange-duration-context Iterable ranges = fileClient.listRanges(new FileRange(1024, 2048L), Duration.ofSeconds(1), new Context(key1, value1)); @@ -556,7 +556,7 @@ public void listRangesMaxOverload() { * Generates a code sample for using {@link FileClient#listHandles()} */ public void listHandles() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.listHandles fileClient.listHandles() .forEach(handleItem -> System.out.printf("List handles completed with handleId %s", @@ -568,7 +568,7 @@ public void listHandles() { * Generates a code sample for using {@link FileClient#listHandles(Integer, Duration, Context)} */ public void listHandlesWithOverload() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.listHandles#integer-duration-context fileClient.listHandles(10, Duration.ofSeconds(1), new Context(key1, value1)) .forEach(handleItem -> System.out.printf("List handles completed with handleId %s", @@ -580,7 +580,7 @@ public void listHandlesWithOverload() { * Generates a code sample for using {@link FileClient#forceCloseHandles(String, Duration, Context)} */ public void forceCloseHandles() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.forceCloseHandles#string-duration-context fileClient.listHandles(10, Duration.ofSeconds(1), new Context(key1, value1)) .forEach(result -> @@ -613,7 +613,7 @@ public void getShareSnapshotId() { * Generates a code sample for using {@link FileClient#getShareName()} */ public void getShareName() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.getShareName String shareName = fileClient.getShareName(); System.out.println("The share name of the directory is " + shareName); @@ -624,7 +624,7 @@ public void getShareName() { * Generates a code sample for using {@link FileClient#getFilePath()} */ public void getName() { - FileClient fileClient = createClientWithSASToken(); + FileClient fileClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileClient.getFilePath String filePath = fileClient.getFilePath(); System.out.println("The name of the file is " + filePath); 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 3ccfb020b787..bad193c6a0dc 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 @@ -32,7 +32,7 @@ public void asyncInitialization() { * Generates code sample for creating a {@link FileServiceAsyncClient} with SAS token. * @return An instance of {@link FileServiceAsyncClient} */ - public FileServiceAsyncClient createAsyncClientWithSASToken() { + public FileServiceAsyncClient createAsyncClientWithSasToken() { // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.sastoken FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") @@ -74,7 +74,7 @@ public FileServiceAsyncClient createAsyncClientWithConnectionString() { * Generates a code sample for using {@link FileServiceAsyncClient#createShare(String)} */ public void createShareAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShare#string fileServiceAsyncClient.createShare("myshare").subscribe( response -> { }, @@ -88,7 +88,7 @@ public void createShareAsync() { * Generates a code sample for using {@link FileServiceAsyncClient#createShareWithResponse(String, Map, Integer)} with metadata */ public void createShareWithResponse() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.metadata fileServiceAsyncClient.createShareWithResponse("test", Collections.singletonMap("share", "metadata"), null) .subscribe( @@ -103,7 +103,7 @@ public void createShareWithResponse() { * Generates a code sample for using {@link FileServiceAsyncClient#createShareWithResponse(String, Map, Integer)} with quota. */ public void createShareAsyncWithQuota() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceAsyncClient.createShareWithResponse#string-map-integer.quota fileServiceAsyncClient.createShareWithResponse("test", null, 10) .subscribe( @@ -119,7 +119,7 @@ public void createShareAsyncWithQuota() { * Generates a code sample for using {@link FileServiceAsyncClient#listShares()} */ public void listSharesAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares fileServiceAsyncClient.listShares().subscribe( shareItem -> System.out.printf("Share %s exists in the account", shareItem.getName()), @@ -133,7 +133,7 @@ public void listSharesAsync() { * Generates a code sample for using {@link FileServiceAsyncClient#listShares(ListSharesOptions)} of prefix. */ public void listSharesAsyncWithPrefix() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.prefix fileServiceAsyncClient.listShares(new ListSharesOptions().setPrefix("azure")).subscribe( shareItem -> System.out.printf("Share %s exists in the account", shareItem.getName()), @@ -147,7 +147,7 @@ public void listSharesAsyncWithPrefix() { * Generates a code sample for using {@link FileServiceAsyncClient#listShares(ListSharesOptions)} of metadata and snapshot. */ public void listSharesAsyncWithOverload() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceAsyncClient.listShares#ListSharesOptions.metadata.snapshot fileServiceAsyncClient.listShares(new ListSharesOptions().setIncludeMetadata(true).setIncludeSnapshots(true)) .subscribe( @@ -162,7 +162,7 @@ public void listSharesAsyncWithOverload() { * Generates a code sample for using {@link FileServiceAsyncClient#deleteShare(String)} */ public void deleteShareAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string fileServiceAsyncClient.deleteShare("test").doOnSuccess( response -> System.out.println("Deleting the share completed.") @@ -174,7 +174,7 @@ public void deleteShareAsync() { * Generates a code sample for using {@link FileServiceAsyncClient#deleteShareWithResponse(String, String)} */ public void deleteShareAsyncMaxOverload() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceAsyncClient.deleteShareWithResponse#string-string OffsetDateTime midnight = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); fileServiceAsyncClient.deleteShareWithResponse("test", midnight.toString()) @@ -187,7 +187,7 @@ public void deleteShareAsyncMaxOverload() { * Generates a code sample for using {@link FileServiceAsyncClient#getProperties()} */ public void getPropertiesAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceAsyncClient.getProperties fileServiceAsyncClient.getProperties() .subscribe(properties -> { @@ -201,7 +201,7 @@ public void getPropertiesAsync() { * Generates a code sample for using {@link FileServiceAsyncClient#getPropertiesWithResponse()} */ public void getPropertiesWithResponse() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceAsyncClient.getPropertiesWithResponse fileServiceAsyncClient.getPropertiesWithResponse() .subscribe(properties -> System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", @@ -214,7 +214,7 @@ public void getPropertiesWithResponse() { * Generates a code sample for using {@link FileServiceAsyncClient#setProperties(FileServiceProperties)} */ public void setPropertiesAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceAsyncClient.setProperties#fileServiceProperties fileServiceAsyncClient.getProperties().subscribe(properties -> { properties.getMinuteMetrics().setEnabled(true); @@ -231,7 +231,7 @@ public void setPropertiesAsync() { * Generates a code sample for using {@link FileServiceAsyncClient#setPropertiesWithResponse(FileServiceProperties)} */ public void setPropertiesWithResponseAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponseAsync#fileServiceProperties fileServiceAsyncClient.getPropertiesWithResponse().subscribe(response -> { FileServiceProperties properties = response.getValue(); @@ -248,7 +248,7 @@ public void setPropertiesWithResponseAsync() { * Generates a code sample for using {@link FileServiceAsyncClient#setPropertiesWithResponse(FileServiceProperties)} to clear CORS in file service. */ public void clearPropertiesAsync() { - FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); + FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceAsyncClient.setPropertiesWithResponse#fileServiceProperties.clearCORS fileServiceAsyncClient.getProperties().subscribe(properties -> { properties.setCors(Collections.emptyList()); 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 00f5a9418c42..1fb39d98fff0 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 @@ -49,7 +49,7 @@ public void asyncInitialization() { * Generates code sample for creating a {@link FileServiceClient} with SAS token. * @return An instance of {@link FileServiceClient} */ - public FileServiceClient createClientWithSASToken() { + public FileServiceClient createClientWithSasToken() { // BEGIN: com.azure.storage.file.fileServiceClient.instantiation.sastoken FileServiceClient fileServiceClient = new FileServiceClientBuilder() .endpoint("https://${accountName}.file.core.windows.net?${SASToken}") @@ -93,7 +93,7 @@ public FileServiceClient createClientWithConnectionString() { * Generates a code sample for using {@link FileServiceClient#createShare(String)} */ public void createShare() { - FileServiceClient fileServiceClient = createClientWithSASToken(); + FileServiceClient fileServiceClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceClient.createShare#string fileServiceClient.createShare("myshare"); System.out.println("Creating the share completed."); @@ -105,7 +105,7 @@ public void createShare() { * Duration, Context)} with metadata */ public void createShareWithMetadata() { - FileServiceClient fileServiceClient = createClientWithSASToken(); + FileServiceClient fileServiceClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.FileServiceClient.createShareWithResponse#string-map-integer-duration-context Response response = fileServiceClient.createShareWithResponse("test", Collections.singletonMap("share", "metadata"), null, Duration.ofSeconds(1), @@ -118,7 +118,7 @@ public void createShareWithMetadata() { * Generates a code sample for using {@link FileServiceClient#listShares()} */ public void listShares() { - FileServiceClient fileServiceClient = createClientWithSASToken(); + FileServiceClient fileServiceClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceClient.listShares fileServiceClient.listShares().forEach( shareItem -> System.out.printf("Share %s exists in the account", shareItem.getName()) @@ -130,7 +130,7 @@ public void listShares() { * Generates a code sample for using {@link FileServiceClient#listShares(ListSharesOptions, Duration, Context)} of prefix. */ public void listSharesWithPrefix() { - FileServiceClient fileServiceClient = createClientWithSASToken(); + FileServiceClient fileServiceClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.FileServiceClient.listShares#ListSharesOptions-Duration-Context1 fileServiceClient.listShares(new ListSharesOptions().setPrefix("azure"), Duration.ofSeconds(1), new Context(key1, value1)).forEach( @@ -144,7 +144,7 @@ public void listSharesWithPrefix() { * of metadata and snapshot. */ public void listSharesWithMetadataAndSnapshot() { - FileServiceClient fileServiceClient = createClientWithSASToken(); + FileServiceClient fileServiceClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.FileServiceClient.listShares#ListSharesOptions-Duration-Context2 fileServiceClient.listShares(new ListSharesOptions().setIncludeMetadata(true) .setIncludeSnapshots(true), Duration.ofSeconds(1), new Context(key1, value1)).forEach( @@ -157,7 +157,7 @@ public void listSharesWithMetadataAndSnapshot() { * Generates a code sample for using {@link FileServiceClient#deleteShare(String)} */ public void deleteShare() { - FileServiceClient fileServiceClient = createClientWithSASToken(); + FileServiceClient fileServiceClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceClient.deleteShare#string fileServiceClient.deleteShare("myshare"); // END: com.azure.storage.file.fileServiceClient.deleteShare#string @@ -168,7 +168,7 @@ public void deleteShare() { * Duration, Context)} */ public void deleteShareMaxOverload() { - FileServiceClient fileServiceClient = createClientWithSASToken(); + FileServiceClient fileServiceClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceClient.deleteShareWithResponse#string-string-duration-context OffsetDateTime midnight = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC); Response response = fileServiceClient.deleteShareWithResponse("test", midnight.toString(), @@ -181,7 +181,7 @@ public void deleteShareMaxOverload() { * Generates a code sample for using {@link FileServiceClient#getProperties()} */ public void getProperties() { - FileServiceClient fileServiceClient = createClientWithSASToken(); + FileServiceClient fileServiceClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceClient.getProperties FileServiceProperties properties = fileServiceClient.getProperties(); System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", properties.getHourMetrics().isEnabled(), @@ -193,7 +193,7 @@ public void getProperties() { * Generates a code sample for using {@link FileServiceClient#getPropertiesWithResponse(Duration, Context)} */ public void getPropertiesWithResponse() { - FileServiceClient fileServiceClient = createClientWithSASToken(); + FileServiceClient fileServiceClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceClient.getPropertiesWithResponse#duration-context FileServiceProperties properties = fileServiceClient.getPropertiesWithResponse( Duration.ofSeconds(1), new Context(key1, value1)).getValue(); @@ -206,7 +206,7 @@ public void getPropertiesWithResponse() { * Generates a code sample for using {@link FileServiceClient#setProperties(FileServiceProperties)} */ public void setProperties() { - FileServiceClient fileServiceClient = createClientWithSASToken(); + FileServiceClient fileServiceClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceClient.setProperties#fileServiceProperties FileServiceProperties properties = fileServiceClient.getProperties(); @@ -222,7 +222,7 @@ public void setProperties() { * Generates a code sample for using {@link FileServiceClient#setProperties(FileServiceProperties)} */ public void setPropertiesWithResponse() { - FileServiceClient fileServiceClient = createClientWithSASToken(); + FileServiceClient fileServiceClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context FileServiceProperties properties = fileServiceClient.getPropertiesWithResponse( Duration.ofSeconds(1), new Context(key1, value1)).getValue(); @@ -240,7 +240,7 @@ public void setPropertiesWithResponse() { * Generates a code sample for using {@link FileServiceClient#setProperties(FileServiceProperties)} to clear CORS in file service. */ public void clearProperties() { - FileServiceClient fileServiceClient = createClientWithSASToken(); + FileServiceClient fileServiceClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.fileServiceClient.setPropertiesWithResponse#fileServiceProperties-Context.clearCORS FileServiceProperties properties = fileServiceClient.getProperties(); properties.setCors(Collections.emptyList()); 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 a86f801c76fb..38d767ba5390 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 @@ -4,7 +4,7 @@ import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.AccessPolicy; -import com.azure.storage.file.models.FileHTTPHeaders; +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; @@ -38,7 +38,7 @@ public void asyncInitialization() { * * @return An instance of {@link ShareAsyncClient} */ - public ShareAsyncClient createAsyncClientWithSASToken() { + public ShareAsyncClient createAsyncClientWithSasToken() { // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.sastoken ShareAsyncClient shareAsyncClient = new ShareClientBuilder() .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") @@ -85,7 +85,7 @@ public ShareAsyncClient createAsyncClientWithConnectionString() { * Generates a code sample for using {@link ShareAsyncClient#create} */ public void createShareAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.create shareAsyncClient.create().subscribe( response -> { @@ -100,7 +100,7 @@ public void createShareAsync() { * Generates a code sample for using {@link ShareAsyncClient#createWithResponse(Map, Integer)} with Metadata. */ public void createWithResponse() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.metadata shareAsyncClient.createWithResponse(Collections.singletonMap("share", "metadata"), null).subscribe( response -> System.out.printf("Creating the share completed with status code %d", response.getStatusCode()), @@ -114,7 +114,7 @@ public void createWithResponse() { * Generates a code sample for using {@link ShareAsyncClient#createWithResponse(Map, Integer)} with Quota. */ public void createShareAsyncMaxOverloadQuota() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.createWithResponse#map-integer.quota shareAsyncClient.createWithResponse(null, 10).subscribe( response -> System.out.printf("Creating the share completed with status code %d", response.getStatusCode()), @@ -128,7 +128,7 @@ public void createShareAsyncMaxOverloadQuota() { * Generates a code sample for using {@link ShareAsyncClient#createDirectory(String)} */ public void createDirectoryAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.createDirectory#string shareAsyncClient.createDirectory("mydirectory").subscribe( response -> { @@ -143,7 +143,7 @@ public void createDirectoryAsync() { * Generates a code sample for using {@link ShareAsyncClient#createFile(String, long)} */ public void createFileAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.createFile#string-long shareAsyncClient.createFile("myfile", 1024).subscribe( response -> { @@ -158,7 +158,7 @@ public void createFileAsync() { * Generates a code sample for using {@link ShareAsyncClient#createSnapshot()} */ public void createSnapshotAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.createSnapshot shareAsyncClient.createSnapshot().subscribe( response -> System.out.println("Successfully creating the share snapshot with snapshot id: " @@ -173,7 +173,7 @@ public void createSnapshotAsync() { * Generates a code sample for using {@link ShareAsyncClient#createSnapshotWithResponse(Map)} */ public void createSnapshotAsyncWithMetadata() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.createSnapshotWithResponse#map shareAsyncClient.createSnapshotWithResponse(Collections.singletonMap("snapshot", "metadata")).subscribe( response -> System.out.println("Successfully creating the share snapshot with snapshot id: " @@ -189,7 +189,7 @@ public void createSnapshotAsyncWithMetadata() { * String, Map)} */ public void createDirectoryWithResponse() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.createDirectoryWithResponse#string-filesmbproperties-string-map FileSmbProperties smbProperties = new FileSmbProperties(); String filePermission = "filePermission"; @@ -204,7 +204,7 @@ public void createDirectoryWithResponse() { * Generates a code sample for using {@link ShareAsyncClient#createFile(String, long)} */ public void createFileAsyncMaxOverload() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.createFile#string-long-filehttpheaders-map shareAsyncClient.createFile("myfile", 1024) .doOnSuccess(response -> System.out.println("Creating the file completed.")); @@ -212,13 +212,13 @@ public void createFileAsyncMaxOverload() { } /** - * Generates a code sample for using {@link ShareAsyncClient#createFileWithResponse(String, long, FileHTTPHeaders, + * Generates a code sample for using {@link ShareAsyncClient#createFileWithResponse(String, long, FileHttpHeaders, * FileSmbProperties, String, Map)} */ public void createFileWithResponse() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.createFileWithResponse#string-long-filehttpheaders-filesmbproperties-string-map - FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + FileHttpHeaders httpHeaders = new FileHttpHeaders() .setFileContentType("text/html") .setFileContentEncoding("gzip") .setFileContentLanguage("en") @@ -242,7 +242,7 @@ public void createFileWithResponse() { * Generates a code sample for using {@link ShareAsyncClient#deleteDirectory(String)} */ public void deleteDirectoryAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.deleteDirectory#string shareAsyncClient.deleteDirectory("mydirectory").subscribe( response -> { @@ -257,7 +257,7 @@ public void deleteDirectoryAsync() { * Generates a code sample for using {@link ShareAsyncClient#deleteFile(String)} */ public void deleteFileAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.deleteFile#string shareAsyncClient.deleteFile("myfile").subscribe( response -> { @@ -272,7 +272,7 @@ public void deleteFileAsync() { * Generates a code sample for using {@link ShareAsyncClient#delete} */ public void deleteShareAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.delete shareAsyncClient.delete().subscribe( response -> System.out.println("Deleting the shareAsyncClient completed."), @@ -286,7 +286,7 @@ public void deleteShareAsync() { * Generates a code sample for using {@link ShareAsyncClient#deleteWithResponse()} */ public void deleteWithResponse() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.deleteWithResponse shareAsyncClient.deleteWithResponse().subscribe( response -> System.out.println("Deleting the shareAsyncClient completed with status code: " @@ -301,7 +301,7 @@ public void deleteWithResponse() { * Generates a code sample for using {@link ShareAsyncClient#getProperties()} */ public void getPropertiesAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.getProperties shareAsyncClient.getProperties() .subscribe(properties -> { @@ -314,7 +314,7 @@ public void getPropertiesAsync() { * Generates a code sample for using {@link ShareAsyncClient#getPropertiesWithResponse()} */ public void getPropertiesWithResponse() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.getPropertiesWithResponse shareAsyncClient.getPropertiesWithResponse() .subscribe(properties -> { @@ -328,7 +328,7 @@ public void getPropertiesWithResponse() { * Generates a code sample for using {@link ShareAsyncClient#setQuota(int)} */ public void setQuotaAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.ShareAsyncClient.setQuota#int shareAsyncClient.setQuota(1024).doOnSuccess(response -> System.out.println("Setting the share quota completed.") @@ -340,7 +340,7 @@ public void setQuotaAsync() { * Generates a code sample for using {@link ShareAsyncClient#setQuotaWithResponse(int)} */ public void setQuotaWithResponse() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.ShareAsyncClient.setQuotaWithResponse#int shareAsyncClient.setQuotaWithResponse(1024) .subscribe(response -> @@ -354,7 +354,7 @@ public void setQuotaWithResponse() { * Generates a code sample for using {@link ShareAsyncClient#setMetadata(Map)} */ public void setMetadataAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.setMetadata#map shareAsyncClient.setMetadata(Collections.singletonMap("share", "updatedMetadata")).doOnSuccess(response -> System.out.println("Setting the share metadata completed.") @@ -366,7 +366,7 @@ public void setMetadataAsync() { * Generates a code sample for using {@link ShareAsyncClient#setMetadataWithResponse(Map)} */ public void setMetadataWithResponse() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.setMetadataWithResponse#map shareAsyncClient.setMetadataWithResponse(Collections.singletonMap("share", "updatedMetadata")) .subscribe(response -> @@ -379,7 +379,7 @@ public void setMetadataWithResponse() { * Generates a code sample for using {@link ShareAsyncClient#setMetadata(Map)} to clear the metadata. */ public void clearMetadataAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.clearMetadata#map shareAsyncClient.setMetadata(null).doOnSuccess(response -> System.out.println("Setting the share metadata completed.") @@ -391,7 +391,7 @@ public void clearMetadataAsync() { * Generates a code sample for using {@link ShareAsyncClient#getAccessPolicy()} */ public void getAccessPolicyAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.getAccessPolicy shareAsyncClient.getAccessPolicy() .subscribe(result -> System.out.printf("Access policy %s allows these permissions: %s", result.getId(), @@ -404,7 +404,7 @@ public void getAccessPolicyAsync() { * Generates a code sample for using {@link ShareAsyncClient#setAccessPolicy(List)} */ public void setAccessPolicyAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.ShareAsyncClient.setAccessPolicy#List AccessPolicy accessPolicy = new AccessPolicy().setPermission("r") .setStart(OffsetDateTime.now(ZoneOffset.UTC)) @@ -420,7 +420,7 @@ public void setAccessPolicyAsync() { * Generates a code sample for using {@link ShareAsyncClient#setAccessPolicyWithResponse(List)} */ public void setAccessPolicyWithResponse() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.ShareAsyncClient.setAccessPolicyWithResponse#List AccessPolicy accessPolicy = new AccessPolicy().setPermission("r") .setStart(OffsetDateTime.now(ZoneOffset.UTC)) @@ -437,7 +437,7 @@ public void setAccessPolicyWithResponse() { * Generates a code sample for using {@link ShareAsyncClient#getStatistics()} */ public void getStatisticsAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.getStatistics shareAsyncClient.getStatistics().doOnSuccess(response -> System.out.printf("The share is using %d GB", response.getShareUsageInGB())); @@ -448,7 +448,7 @@ public void getStatisticsAsync() { * Generates a code sample for using {@link ShareAsyncClient#createPermission(String)} */ public void createPermissionAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.createPermission#string shareAsyncClient.createPermission("filePermission").subscribe( response -> System.out.printf("The file permission key is %s", response)); @@ -459,7 +459,7 @@ public void createPermissionAsync() { * Generates a code sample for using {@link ShareAsyncClient#createPermissionWithResponse(String)} */ public void createPermissionWithResponse() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.createPermissionWithResponse#string shareAsyncClient.createPermissionWithResponse("filePermission").subscribe( response -> System.out.printf("The file permission key is %s", response.getValue())); @@ -470,7 +470,7 @@ public void createPermissionWithResponse() { * Generates a code sample for using {@link ShareAsyncClient#getPermission(String)} */ public void getPermissionAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.getPermission#string shareAsyncClient.getPermission("filePermissionKey").subscribe( response -> System.out.printf("The file permission is %s", response)); @@ -481,7 +481,7 @@ public void getPermissionAsync() { * Generates a code sample for using {@link ShareAsyncClient#getPermissionWithResponse(String)} */ public void getPermissionWithResponse() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.getPermissionWithResponse#string shareAsyncClient.getPermissionWithResponse("filePermissionKey").subscribe( response -> System.out.printf("The file permission is %s", response.getValue())); @@ -492,7 +492,7 @@ public void getPermissionWithResponse() { * Generates a code sample for using {@link ShareAsyncClient#getStatisticsWithResponse()} */ public void getStatisticsWithResponse() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.getStatisticsWithResponse shareAsyncClient.getStatisticsWithResponse().subscribe(response -> System.out.printf("The share is using %d GB", response.getValue().getShareUsageInGB())); @@ -520,7 +520,7 @@ public void getSnapshotIdAsync() { * Generates a code sample for using {@link ShareAsyncClient#getShareName()} */ public void getShareNameAsync() { - ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + ShareAsyncClient shareAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.getShareName String shareName = shareAsyncClient.getShareName(); System.out.println("The name of the share is " + shareName); 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 9c970872c47e..5c589b1984a0 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 @@ -6,7 +6,7 @@ import com.azure.core.util.Context; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.AccessPolicy; -import com.azure.storage.file.models.FileHTTPHeaders; +import com.azure.storage.file.models.FileHttpHeaders; import com.azure.storage.file.models.NtfsFileAttributes; import com.azure.storage.file.models.ShareInfo; import com.azure.storage.file.models.ShareProperties; @@ -46,7 +46,7 @@ public void initialization() { * Generates code sample for creating a {@link ShareClient} with SAS token * @return An instance of {@link ShareClient} */ - public ShareClient createClientWithSASToken() { + public ShareClient createClientWithSasToken() { // BEGIN: com.azure.storage.file.shareClient.instantiation.sastoken ShareClient shareClient = new ShareClientBuilder() @@ -93,7 +93,7 @@ public ShareClient createClientWithConnectionString() { * Generates a code sample for using {@link ShareClient#create()} */ public void createShare() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.create ShareInfo response = shareClient.create(); System.out.println("Complete creating the shares with status code: " + response); @@ -104,7 +104,7 @@ public void createShare() { * Generates a code sample for using {@link ShareClient#create()}. */ public void createShareMaxOverloadMetadata() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.create#map-integer.metadata ShareInfo response = shareClient.create(); System.out.println("Complete creating the shares."); @@ -116,7 +116,7 @@ public void createShareMaxOverloadMetadata() { * Duration, Context)} with Quota. */ public void createWithResponse() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.ShareClient.createWithResponse#map-integer-duration-context.quota Response response = shareClient.createWithResponse(null, 10, Duration.ofSeconds(1), new Context(key1, value1)); @@ -129,7 +129,7 @@ public void createWithResponse() { * Duration, Context)} with Metadata. */ public void createWithResponseMetadata() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.ShareClient.createWithResponse#map-integer-duration-context.metadata Response response = shareClient.createWithResponse(Collections.singletonMap("share", "metadata"), null, Duration.ofSeconds(1), new Context(key1, value1)); @@ -141,7 +141,7 @@ public void createWithResponseMetadata() { * Generates a code sample for using {@link ShareClient#createDirectory(String)} ()} */ public void createDirectory() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.createDirectory#string DirectoryClient response = shareClient.createDirectory("mydirectory"); System.out.println("Complete creating the directory."); @@ -152,7 +152,7 @@ public void createDirectory() { * Generates a code sample for using {@link ShareClient#createDirectoryWithResponse(String, FileSmbProperties, String, Map, Duration, Context)} */ public void createDirectoryWithResponse() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.createDirectoryWithResponse#string-filesmbproperties-string-map-duration-context FileSmbProperties smbProperties = new FileSmbProperties(); String filePermission = "filePermission"; @@ -167,7 +167,7 @@ public void createDirectoryWithResponse() { * Generates a code sample for using {@link ShareClient#createFile(String, long)} */ public void createFile() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.createFile#string-long FileClient response = shareClient.createFile("myfile", 1024); System.out.println("Complete creating the file with snapshot Id:" + response.getShareSnapshotId()); @@ -178,7 +178,7 @@ public void createFile() { * Generates a code sample for using {@link ShareClient#createSnapshot()} */ public void createSnapshot() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.createSnapshot ShareSnapshotInfo response = shareClient.createSnapshot(); System.out.println("Complete creating the share snpashot with snapshot id: " + response.getSnapshot()); @@ -189,7 +189,7 @@ public void createSnapshot() { * Generates a code sample for using {@link ShareClient#createSnapshotWithResponse(Map, Duration, Context)} */ public void createSnapshotWithMetadata() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.createSnapshotWithResponse#map-duration-context Response response = shareClient.createSnapshotWithResponse(Collections.singletonMap("snpashot", "metadata"), @@ -199,12 +199,12 @@ public void createSnapshotWithMetadata() { } /** - * Generates a code sample for using {@link ShareClient#createFileWithResponse(String, long, FileHTTPHeaders, FileSmbProperties, String, Map, Duration, Context)} + * Generates a code sample for using {@link ShareClient#createFileWithResponse(String, long, FileHttpHeaders, FileSmbProperties, String, Map, Duration, Context)} */ public void createFileWithResponse() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.createFileWithResponse#string-long-filehttpheaders-filesmbproperties-string-map-duration-context - FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + FileHttpHeaders httpHeaders = new FileHttpHeaders() .setFileContentType("text/html") .setFileContentEncoding("gzip") .setFileContentLanguage("en") @@ -228,7 +228,7 @@ public void createFileWithResponse() { * Generates a code sample for using {@link ShareClient#deleteDirectory(String)} */ public void deleteDirectory() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.deleteDirectory#string shareClient.deleteDirectory("mydirectory"); System.out.println("Completed deleting the directory."); @@ -239,7 +239,7 @@ public void deleteDirectory() { * Generates a code sample for using {@link ShareClient#deleteDirectoryWithResponse(String, Duration, Context)} */ public void deleteDirectoryWithResponse() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.deleteDirectoryWithResponse#string-duration-context Response response = shareClient.deleteDirectoryWithResponse("mydirectory", Duration.ofSeconds(1), new Context(key1, value1)); @@ -251,7 +251,7 @@ public void deleteDirectoryWithResponse() { * Generates a code sample for using {@link ShareClient#deleteFile(String)} */ public void deleteFile() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.deleteFile#string shareClient.deleteFile("myfile"); System.out.println("Complete deleting the file."); @@ -262,7 +262,7 @@ public void deleteFile() { * Generates a code sample for using {@link ShareClient#deleteFileWithResponse(String, Duration, Context)} */ public void deleteFileWithResponse() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.deleteFileWithResponse#string-duration-context Response response = shareClient.deleteFileWithResponse("myfile", Duration.ofSeconds(1), new Context(key1, value1)); @@ -274,7 +274,7 @@ public void deleteFileWithResponse() { * Generates a code sample for using {@link ShareClient#delete} */ public void deleteShare() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.delete shareClient.delete(); System.out.println("Completed deleting the share."); @@ -285,7 +285,7 @@ public void deleteShare() { * Generates a code sample for using {@link ShareClient#deleteWithResponse(Duration, Context)} */ public void deleteShareWithResponse() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.deleteWithResponse#duration-context Response response = shareClient.deleteWithResponse(Duration.ofSeconds(1), new Context(key1, value1)); System.out.println("Complete deleting the share with status code: " + response.getStatusCode()); @@ -296,7 +296,7 @@ public void deleteShareWithResponse() { * Generates a code sample for using {@link ShareClient#getProperties()} */ public void getProperties() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.getProperties ShareProperties properties = shareClient.getProperties(); System.out.printf("Share quota: %d, Metadata: %s", properties.getQuota(), properties.getMetadata()); @@ -307,7 +307,7 @@ public void getProperties() { * Generates a code sample for using {@link ShareClient#getPropertiesWithResponse(Duration, Context)} */ public void getPropertiesWithResponse() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.getPropertiesWithResponse#duration-context ShareProperties properties = shareClient.getPropertiesWithResponse( Duration.ofSeconds(1), new Context(key1, value1)).getValue(); @@ -319,7 +319,7 @@ public void getPropertiesWithResponse() { * Generates a code sample for using {@link ShareClient#setQuota(int)} */ public void setQuota() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.ShareClient.setQuota#int System.out.println("Setting the share quota completed." + shareClient.setQuota(1024)); // END: com.azure.storage.file.ShareClient.setQuota#int @@ -329,7 +329,7 @@ public void setQuota() { * Generates a code sample for using {@link ShareClient#setQuotaWithResponse(int, Duration, Context)} */ public void setQuotaWithResponse() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.setQuotaWithResponse#int-duration-context Response response = shareClient.setQuotaWithResponse(1024, Duration.ofSeconds(1), new Context(key1, value1)); @@ -341,7 +341,7 @@ public void setQuotaWithResponse() { * Generates a code sample for using {@link ShareClient#setMetadata(Map)} */ public void setMetadata() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.setMetadata#map shareClient.setMetadata(Collections.singletonMap("share", "updatedMetadata")); System.out.println("Setting the share metadata."); @@ -352,7 +352,7 @@ public void setMetadata() { * Generates a code sample for using {@link ShareClient#setMetadataWithResponse(Map, Duration, Context)} */ public void setMetadataWithResponse() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.setMetadataWithResponse#map-duration-context Response response = shareClient.setMetadataWithResponse( Collections.singletonMap("share", "updatedMetadata"), Duration.ofSeconds(1), @@ -366,7 +366,7 @@ public void setMetadataWithResponse() { * Generates a code sample for using {@link ShareClient#setMetadata(Map)} to clear the metadata. */ public void clearMetadata() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.clearMetadata#map shareClient.setMetadata(null); System.out.println("Clear metadata completed."); @@ -378,7 +378,7 @@ public void clearMetadata() { * Generates a code sample for using {@link ShareClient#getAccessPolicy()} */ public void getAccessPolicy() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.getAccessPolicy for (SignedIdentifier result : shareClient.getAccessPolicy()) { System.out.printf("Access policy %s allows these permissions: %s", @@ -391,7 +391,7 @@ public void getAccessPolicy() { * Generates a code sample for using {@link ShareClient#setAccessPolicy(List)} */ public void setAccessPolicy() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.ShareClient.setAccessPolicy#List AccessPolicy accessPolicy = new AccessPolicy().setPermission("r") .setStart(OffsetDateTime.now(ZoneOffset.UTC)) @@ -408,7 +408,7 @@ public void setAccessPolicy() { * Generates a code sample for using {@link ShareClient#setAccessPolicyWithResponse(List, Duration, Context)} */ public void setAccessPolicyWithResponse() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.setAccessPolicyWithResponse#list-duration-context AccessPolicy accessPolicy = new AccessPolicy().setPermission("r") .setStart(OffsetDateTime.now(ZoneOffset.UTC)) @@ -427,7 +427,7 @@ public void setAccessPolicyWithResponse() { * Generates a code sample for using {@link ShareClient#getStatistics()} */ public void getStatistics() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.getStatistics ShareStatistics response = shareClient.getStatistics(); System.out.printf("The share is using %d GB", response.getShareUsageInGB()); @@ -438,7 +438,7 @@ public void getStatistics() { * Generates a code sample for using {@link ShareClient#getStatisticsWithResponse(Duration, Context)} */ public void getStatisticsWithResponse() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.getStatisticsWithResponse#duration-context Response response = shareClient.getStatisticsWithResponse( Duration.ofSeconds(1), new Context(key1, value1)); @@ -450,7 +450,7 @@ public void getStatisticsWithResponse() { * Generates a code sample for using {@link ShareClient#createPermission(String)} */ public void createPermissionAsync() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.createPermission#string String response = shareClient.createPermission("filePermission"); System.out.printf("The file permission key is %s", response); @@ -461,7 +461,7 @@ public void createPermissionAsync() { * Generates a code sample for using {@link ShareClient#createPermissionWithResponse(String, Context)} */ public void createPermissionWithResponse() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.createPermissionWithResponse#string-context Response response = shareClient.createPermissionWithResponse("filePermission", Context.NONE); System.out.printf("The file permission key is %s", response.getValue()); @@ -472,7 +472,7 @@ public void createPermissionWithResponse() { * Generates a code sample for using {@link ShareClient#getPermission(String)} */ public void getPermission() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.getPermission#string String response = shareClient.getPermission("filePermissionKey"); System.out.printf("The file permission is %s", response); @@ -483,7 +483,7 @@ public void getPermission() { * Generates a code sample for using {@link ShareClient#getPermissionWithResponse(String, Context)} */ public void getPermissionWithResponse() { - ShareClient shareClient = createClientWithSASToken(); + ShareClient shareClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.getPermissionWithResponse#string-context Response response = shareClient.getPermissionWithResponse("filePermissionKey", Context.NONE); System.out.printf("The file permission is %s", response.getValue()); @@ -510,7 +510,7 @@ public void getSnapshotId() { * Generates a code sample for using {@link ShareClient#getShareName()} */ public void getShareName() { - ShareClient shareAsyncClient = createClientWithSASToken(); + ShareClient shareAsyncClient = createClientWithSasToken(); // BEGIN: com.azure.storage.file.shareClient.getShareName String shareName = shareAsyncClient.getShareName(); System.out.println("The name of the share is " + shareName); diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAPITests.groovy index a2638b23ceab..533e498262e3 100644 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAPITests.groovy +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAPITests.groovy @@ -5,7 +5,7 @@ package com.azure.storage.file 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.FileHttpHeaders import com.azure.storage.file.models.NtfsFileAttributes import com.azure.storage.file.models.ShareSnapshotInfo import com.azure.storage.file.models.StorageErrorCode @@ -511,7 +511,7 @@ class DirectoryAPITests extends APISpec { def "Create file maxOverload"() { given: primaryDirectoryClient.create() - FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + FileHttpHeaders httpHeaders = new FileHttpHeaders() .setFileContentType("txt") smbProperties.setFileCreationTime(getUTCNow()) .setFileLastWriteTime(getUTCNow()) @@ -534,11 +534,11 @@ class DirectoryAPITests extends APISpec { FileTestHelper.assertExceptionStatusCodeAndMessage(e, 400, errMsg) where: - fileName | maxSize | httpHeaders | metadata | errMsg - "testfile:" | 1024 | null | testMetadata | StorageErrorCode.INVALID_RESOURCE_NAME - "fileName" | -1 | null | testMetadata | StorageErrorCode.OUT_OF_RANGE_INPUT - "fileName" | 1024 | new FileHTTPHeaders().setFileContentMD5(new byte[0]) | testMetadata | StorageErrorCode.INVALID_HEADER_VALUE - "fileName" | 1024 | null | Collections.singletonMap("", "value") | StorageErrorCode.EMPTY_METADATA_KEY + fileName | maxSize | httpHeaders | metadata | errMsg + "testfile:" | 1024 | null | testMetadata | StorageErrorCode.INVALID_RESOURCE_NAME + "fileName" | -1 | null | testMetadata | StorageErrorCode.OUT_OF_RANGE_INPUT + "fileName" | 1024 | new FileHttpHeaders().setFileContentMD5(new byte[0]) | testMetadata | StorageErrorCode.INVALID_HEADER_VALUE + "fileName" | 1024 | null | Collections.singletonMap("", "value") | StorageErrorCode.EMPTY_METADATA_KEY } diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAsyncAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAsyncAPITests.groovy index 94c0c368330c..3513e4345058 100644 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAsyncAPITests.groovy +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/DirectoryAsyncAPITests.groovy @@ -6,7 +6,7 @@ package com.azure.storage.file 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.FileHttpHeaders import com.azure.storage.file.models.NtfsFileAttributes import com.azure.storage.file.models.StorageErrorCode import reactor.test.StepVerifier @@ -497,7 +497,7 @@ class DirectoryAsyncAPITests extends APISpec { def "Create file maxOverload"() { given: primaryDirectoryAsyncClient.create().block() - FileHTTPHeaders httpHeaders = new FileHTTPHeaders() + FileHttpHeaders httpHeaders = new FileHttpHeaders() .setFileContentType("txt") smbProperties.setFileCreationTime(getUTCNow()) .setFileLastWriteTime(getUTCNow()) @@ -524,11 +524,11 @@ class DirectoryAsyncAPITests extends APISpec { }) where: - fileName | maxSize | httpHeaders | metadata | errMsg - "testfile:" | 1024 | null | testMetadata | StorageErrorCode.INVALID_RESOURCE_NAME - "fileName" | -1 | null | testMetadata | StorageErrorCode.OUT_OF_RANGE_INPUT - "fileName" | 1024 | new FileHTTPHeaders().setFileContentMD5(new byte[0]) | testMetadata | StorageErrorCode.INVALID_HEADER_VALUE - "fileName" | 1024 | null | Collections.singletonMap("", "value") | StorageErrorCode.EMPTY_METADATA_KEY + fileName | maxSize | httpHeaders | metadata | errMsg + "testfile:" | 1024 | null | testMetadata | StorageErrorCode.INVALID_RESOURCE_NAME + "fileName" | -1 | null | testMetadata | StorageErrorCode.OUT_OF_RANGE_INPUT + "fileName" | 1024 | new FileHttpHeaders().setFileContentMD5(new byte[0]) | testMetadata | StorageErrorCode.INVALID_HEADER_VALUE + "fileName" | 1024 | null | Collections.singletonMap("", "value") | StorageErrorCode.EMPTY_METADATA_KEY } 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 5ab6d3ea6d95..22c9df4d969f 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 @@ -11,7 +11,7 @@ import com.azure.core.util.Context import com.azure.storage.common.Constants import com.azure.storage.common.credentials.SharedKeyCredential import com.azure.storage.file.models.FileCopyInfo -import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.FileHttpHeaders import com.azure.storage.file.models.FileRange import com.azure.storage.file.models.NtfsFileAttributes import com.azure.storage.file.models.ShareSnapshotInfo @@ -47,7 +47,7 @@ class FileAPITests extends APISpec { shareClient.create() primaryFileClient = fileBuilderHelper(interceptorManager, shareName, filePath).buildFileClient() testMetadata = Collections.singletonMap("testmetadata", "value") - httpHeaders = new FileHTTPHeaders().setFileContentLanguage("en") + httpHeaders = new FileHttpHeaders().setFileContentLanguage("en") .setFileContentType("application/octet-stream") smbProperties = new FileSmbProperties() .setNtfsFileAttributes(EnumSet.of(NtfsFileAttributes.NORMAL) as EnumSet) @@ -399,7 +399,7 @@ class FileAPITests extends APISpec { .setPermissions(new FileSasPermission().setReadPermission(true).toString()) .setCanonicalName(primaryFileClient.getShareName(), primaryFileClient.getFilePath(), credential.getAccountName()) .setResource(Constants.UrlConstants.SAS_FILE_CONSTANT) - .generateSASQueryParameters(credential) + .generateSasQueryParameters(credential) .encode() when: 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 896539f3858b..b773849bdedd 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 @@ -7,7 +7,7 @@ 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.FileHttpHeaders import com.azure.storage.file.models.FileRange import com.azure.storage.file.models.NtfsFileAttributes import com.azure.storage.file.models.StorageErrorCode @@ -43,7 +43,7 @@ class FileAsyncAPITests extends APISpec { shareClient.create() primaryFileAsyncClient = fileBuilderHelper(interceptorManager, shareName, filePath).buildFileAsyncClient() testMetadata = Collections.singletonMap("testmetadata", "value") - httpHeaders = new FileHTTPHeaders().setFileContentLanguage("en") + httpHeaders = new FileHttpHeaders().setFileContentLanguage("en") .setFileContentType("application/octet-stream") smbProperties = new FileSmbProperties() .setNtfsFileAttributes(EnumSet.of(NtfsFileAttributes.NORMAL)) @@ -392,7 +392,7 @@ class FileAsyncAPITests extends APISpec { .setPermissions(new FileSasPermission().setReadPermission(true).toString()) .setCanonicalName(primaryFileAsyncClient.getShareName(), primaryFileAsyncClient.getFilePath(), credential.getAccountName()) .setResource(Constants.UrlConstants.SAS_FILE_CONSTANT) - .generateSASQueryParameters(credential) + .generateSasQueryParameters(credential) .encode() when: 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 ecc68d8a30db..66c39e98a0b1 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 @@ -189,7 +189,7 @@ class FileSASTests extends APISpec { .setContentType(contentType) .setCanonicalName(primaryFileClient.getShareName(), primaryFileClient.getFilePath(), credential.getAccountName()) .setResource(Constants.UrlConstants.SAS_FILE_CONSTANT) - .generateSASQueryParameters(credential) + .generateSasQueryParameters(credential) .encode() then: @@ -251,7 +251,7 @@ class FileSASTests extends APISpec { .setContentType(contentType) .setCanonicalName(primaryFileClient.getShareName(), primaryFileClient.getFilePath(), credential.getAccountName()) .setResource(Constants.UrlConstants.SAS_FILE_CONSTANT) - .generateSASQueryParameters(credential) + .generateSasQueryParameters(credential) .encode() def client = fileBuilderHelper(interceptorManager, shareName, filePath) @@ -296,7 +296,7 @@ class FileSASTests extends APISpec { .setIdentifier(identifier.getId()) .setCanonicalName(primaryShareClient.getShareName(), credential.getAccountName()) .setResource(Constants.UrlConstants.SAS_SHARE_CONSTANT) - .generateSASQueryParameters(credential) + .generateSasQueryParameters(credential) .encode() ShareClient client1 = shareBuilderHelper(interceptorManager, primaryShareClient.getShareName()) @@ -312,7 +312,7 @@ class FileSASTests extends APISpec { .setExpiryTime(expiryTime) .setCanonicalName(primaryShareClient.getShareName(), credential.getAccountName()) .setResource(Constants.UrlConstants.SAS_SHARE_CONSTANT) - .generateSASQueryParameters(credential) + .generateSasQueryParameters(credential) .encode() def client2 = shareBuilderHelper(interceptorManager, primaryShareClient.getShareName()) diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAPITests.groovy index 168cc2c80717..ce2dab569794 100644 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAPITests.groovy +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAPITests.groovy @@ -5,7 +5,7 @@ package com.azure.storage.file import com.azure.core.http.netty.NettyAsyncHttpClientBuilder import com.azure.storage.common.credentials.SharedKeyCredential -import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.FileHttpHeaders import com.azure.storage.file.models.NtfsFileAttributes import com.azure.storage.file.models.ShareSnapshotInfo import com.azure.storage.file.models.StorageErrorCode @@ -381,7 +381,7 @@ class ShareAPITests extends APISpec { fileName | maxSize | httpHeaders | metadata | errMsg "testfile:" | 1024 | null | testMetadata | StorageErrorCode.INVALID_RESOURCE_NAME "fileName" | -1 | null | testMetadata | StorageErrorCode.OUT_OF_RANGE_INPUT - "fileName" | 1024 | new FileHTTPHeaders().setFileContentMD5(new byte[0]) | testMetadata | StorageErrorCode.INVALID_HEADER_VALUE + "fileName" | 1024 | new FileHttpHeaders().setFileContentMD5(new byte[0]) | testMetadata | StorageErrorCode.INVALID_HEADER_VALUE "fileName" | 1024 | null | Collections.singletonMap("", "value") | StorageErrorCode.EMPTY_METADATA_KEY } diff --git a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAsyncAPITests.groovy b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAsyncAPITests.groovy index 2d43a9884227..401ceb268f3e 100644 --- a/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAsyncAPITests.groovy +++ b/sdk/storage/azure-storage-file/src/test/java/com/azure/storage/file/ShareAsyncAPITests.groovy @@ -5,7 +5,7 @@ package com.azure.storage.file import com.azure.core.http.netty.NettyAsyncHttpClientBuilder import com.azure.storage.common.credentials.SharedKeyCredential -import com.azure.storage.file.models.FileHTTPHeaders +import com.azure.storage.file.models.FileHttpHeaders import com.azure.storage.file.models.NtfsFileAttributes import com.azure.storage.file.models.StorageErrorCode import reactor.test.StepVerifier @@ -363,7 +363,7 @@ class ShareAsyncAPITests extends APISpec { def "Create file maxOverload"() { given: primaryShareAsyncClient.create().block() - FileHTTPHeaders httpHeaders = new FileHTTPHeaders().setFileContentType("txt") + FileHttpHeaders httpHeaders = new FileHttpHeaders().setFileContentType("txt") smbProperties.setFileCreationTime(getUTCNow()) .setFileLastWriteTime(getUTCNow()) expect: @@ -388,11 +388,11 @@ class ShareAsyncAPITests extends APISpec { } where: - fileName | maxSize | httpHeaders | metadata | errMsg - "testfile:" | 1024 | null | testMetadata | StorageErrorCode.INVALID_RESOURCE_NAME - "fileName" | -1 | null | testMetadata | StorageErrorCode.OUT_OF_RANGE_INPUT - "fileName" | 1024 | new FileHTTPHeaders().setFileContentMD5(new byte[0]) | testMetadata | StorageErrorCode.INVALID_HEADER_VALUE - "fileName" | 1024 | null | Collections.singletonMap("", "value") | StorageErrorCode.EMPTY_METADATA_KEY + fileName | maxSize | httpHeaders | metadata | errMsg + "testfile:" | 1024 | null | testMetadata | StorageErrorCode.INVALID_RESOURCE_NAME + "fileName" | -1 | null | testMetadata | StorageErrorCode.OUT_OF_RANGE_INPUT + "fileName" | 1024 | new FileHttpHeaders().setFileContentMD5(new byte[0]) | testMetadata | StorageErrorCode.INVALID_HEADER_VALUE + "fileName" | 1024 | null | Collections.singletonMap("", "value") | StorageErrorCode.EMPTY_METADATA_KEY } 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 6ef1b2aec995..2ef8c10b6025 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 @@ -13,7 +13,7 @@ /** * QueueServiceSasSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage service. Once - * all the values here are set appropriately, call generateSASQueryParameters to obtain a representation of the SAS + * all the values here are set appropriately, call generateSasQueryParameters to obtain a representation of the SAS * which can actually be applied to queue urls. Note: that both this class and {@link QueueServiceSasQueryParameters} * exist because the former is mutable and a logical representation while the latter is immutable and used to generate * actual REST requests. @@ -262,7 +262,7 @@ public QueueServiceSasSignatureValues setIdentifier(String identifier) { * {@code canonicalName} is null. Or if {@code identifier} is null and any or {@code expiryTime} or * {@code permissions} is null. Or if {@code expiryTime} and {@code permissions} and {@code identifier} is null */ - public QueueServiceSasQueryParameters generateSASQueryParameters(SharedKeyCredential sharedKeyCredentials) { + public QueueServiceSasQueryParameters generateSasQueryParameters(SharedKeyCredential sharedKeyCredentials) { Utility.assertNotNull("sharedKeyCredentials", sharedKeyCredentials); assertGenerateOK(); @@ -275,7 +275,7 @@ public QueueServiceSasQueryParameters generateSASQueryParameters(SharedKeyCreden } /** - * Common assertions for generateSASQueryParameters overloads. + * Common assertions for generateSasQueryParameters overloads. */ private void assertGenerateOK() { Utility.assertNotNull("version", this.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 b8aac7689a64..5d234b73fc06 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 @@ -19,7 +19,7 @@ public class QueueAsyncJavaDocCodeSamples { - private QueueAsyncClient client = createAsyncClientWithSASToken(); + private QueueAsyncClient client = createAsyncClientWithSasToken(); /** * Generates code sample for creating a {@link QueueAsyncClient}. @@ -38,7 +38,7 @@ public void buildQueueAsyncClient() { * * @return An instance of {@link QueueAsyncClient} */ - public QueueAsyncClient createAsyncClientWithSASToken() { + public QueueAsyncClient createAsyncClientWithSasToken() { // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation.sastoken QueueAsyncClient queueAsyncClient = new QueueClientBuilder() .endpoint("https://{accountName}.queue.core.windows.net?{SASToken}") @@ -429,7 +429,7 @@ public void getAccessPolicyAsync() { * Generates a code sample for using {@link QueueAsyncClient#setAccessPolicyWithResponse(List)} */ public void setAccessPolicyWithResponse() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + QueueAsyncClient queueAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.queue.QueueAsyncClient.setAccessPolicyWithResponse#List AccessPolicy accessPolicy = new AccessPolicy().setPermission("r") .setStart(OffsetDateTime.now(ZoneOffset.UTC)) @@ -446,7 +446,7 @@ public void setAccessPolicyWithResponse() { * Generates a code sample for using {@link QueueAsyncClient#setAccessPolicy(List)} */ public void setAccessPolicyAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + QueueAsyncClient queueAsyncClient = createAsyncClientWithSasToken(); // BEGIN: com.azure.storage.queue.QueueAsyncClient.setAccessPolicy#List AccessPolicy accessPolicy = new AccessPolicy().setPermission("r") .setStart(OffsetDateTime.now(ZoneOffset.UTC)) 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 a60c840ee412..74ff4abd6974 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 @@ -26,7 +26,7 @@ public class QueueJavaDocCodeSamples { private String key1 = "key1"; private String value1 = "val1"; - private QueueClient client = createClientWithSASToken(); + private QueueClient client = createClientWithSasToken(); /** * Generates code sample for creating a {@link QueueClient}. @@ -45,7 +45,7 @@ public void buildQueueClient() { * * @return An instance of {@link QueueClient} */ - public QueueClient createClientWithSASToken() { + public QueueClient createClientWithSasToken() { // BEGIN: com.azure.storage.queue.queueClient.instantiation.sastoken QueueClient client = new QueueClientBuilder() .endpoint("https://${accountName}.queue.core.windows.net?${SASToken}") 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 2db6612086c2..930009049429 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 @@ -15,7 +15,7 @@ */ public class QueueServiceAsyncJavaDocCodeSamples { - private QueueServiceAsyncClient client = createAsyncClientWithSASToken(); + private QueueServiceAsyncClient client = createAsyncClientWithSasToken(); /** * Generates code sample for creating a {@link QueueServiceAsyncClient}. @@ -34,7 +34,7 @@ public void buildQueueServiceAsyncClient() { * * @return An instance of {@link QueueServiceAsyncClient} */ - public QueueServiceAsyncClient createAsyncClientWithSASToken() { + public QueueServiceAsyncClient createAsyncClientWithSasToken() { // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation.sastoken QueueServiceAsyncClient client = new QueueServiceClientBuilder() .endpoint("https://{accountName}.queue.core.windows.net?{SASToken}") 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 74543642f120..2d739aa1d454 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 @@ -18,7 +18,7 @@ */ public class QueueServiceJavaDocCodeSamples { - private QueueServiceClient client = createClientWithSASToken(); + private QueueServiceClient client = createClientWithSasToken(); private String key1 = "key1"; private String value1 = "val1"; @@ -39,7 +39,7 @@ public void buildQueueServiceClient() { * * @return An instance of {@link QueueServiceClient} */ - public QueueServiceClient createClientWithSASToken() { + public QueueServiceClient createClientWithSasToken() { // BEGIN: com.azure.storage.queue.queueServiceClient.instantiation.sastoken QueueServiceClient client = new QueueServiceClientBuilder() .endpoint("https://${accountName}.queue.core.windows.net?${SASToken}") 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 17df71e3267b..5f560bb2edf5 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 @@ -119,7 +119,7 @@ class QueueSASTests extends APISpec { .setProtocol(sasProtocol) .setIpRange(ipRange) .setCanonicalName(queueClient.getQueueName(), credential.getAccountName()) - .generateSASQueryParameters(credential) + .generateSasQueryParameters(credential) .encode() def clientPermissions = queueBuilderHelper(interceptorManager) @@ -169,7 +169,7 @@ class QueueSASTests extends APISpec { .setProtocol(sasProtocol) .setIpRange(ipRange) .setCanonicalName(queueClient.getQueueName(), credential.getAccountName()) - .generateSASQueryParameters(credential) + .generateSasQueryParameters(credential) .encode() def clientPermissions = queueBuilderHelper(interceptorManager) @@ -217,7 +217,7 @@ class QueueSASTests extends APISpec { def sasIdentifier = new QueueServiceSasSignatureValues() .setIdentifier(identifier.getId()) .setCanonicalName(queueClient.getQueueName(), credential.getAccountName()) - .generateSASQueryParameters(credential) + .generateSasQueryParameters(credential) .encode() def clientBuilder = queueBuilderHelper(interceptorManager)